I already have a list of stuff in my data.txt file.
How do I add stuff to that data.txt file without erasing what's already in it?
Thanks in advance
I already have a list of stuff in my data.txt file.
How do I add stuff to that data.txt file without erasing what's already in it?
Thanks in advance
You open the file with the ios::app mode.
My best code is written with the delete key.
ofstream outfile("data.txt", ofstream::ate);
opens the file in append mode.
Here is what I have tried...
string newdata;
ofstream fout ("data.txt", ios:app);
fout << newdata;
When I do this though, it erases everything that was already in it.
I also tried the same only with ofstream::ate and it did the same thing. It erases everything and writes only newdata;
Last edited by noodle24; 09-23-2006 at 12:35 PM.
Yes that was just a typo. I have tried ios::app
could you post your code? There may be something else causing this.