add/delete/output with file c++


With the .txt file below for example. I need some suggestions how I can add information to the file, or delete a certain line, and how to save the changed .txt file and output it to output file.

Using dynamic array


// .txt file
ABC 000 1111
HELLO 111 1234
heyheyey 123 2345 //let's say I want to delete this line, how would I do that.
addthis 999 6969 //how would I add this to this file using class/dynamic arrays?



Thanks
> delete a certain line
create another file with all the lines except for that one,
then rename the file overwritting the original.

> add information to the file
http://www.cplusplus.com/reference/fstream/ofstream/ofstream/ (append)
I have to make a menu, then choose which line the user wants to delete. How does that work using another file?
Topic archived. No new replies allowed.