Google can't answer me..

Hai.

I'm pretty new to C++, and i was wondering if i could make a program to open a .txt file, and then delete something in it and type something new instead. It would be alot easier to help my friend, if i just could send him a .exe instead og giving him a trip through 50 folders, and then make him open a file and write something.. :)

I would like to know if i could make a program to move files or create new ones (thinking of .txt atm).

Thanks :)
closed account (zb0S216C)
i was wondering if i could make a program to open a .txt file, and then delete something in it and type something new instead.

Sounds like you need ifstream( read from the file ) and ofstream( write to the file ). There is a downside. You cannot modify a piece of information within a file. What you need to do is this: Open the file, extract it's contents, modify the piece of information you want, then place all of the information back into the file.

References:
http://www.cplusplus.com/reference/iostream/ifstream/
http://www.cplusplus.com/reference/iostream/ofstream/
Last edited on
That is, IF you need to use C++... Will the substitution be the same for all files or should it prompt for insertion text?

The first thing that comes to mind is a find / sed command in Linux. Maybe write a little Perl script for windows.


Oh and you should use Google to lookup how to use Google. It most definitely CAN help you...
Last edited on
Topic archived. No new replies allowed.