DaniWeb IT Discussion Community

DaniWeb IT Discussion Community (http://www.daniweb.com/forums/index.php)
-   C++ (http://www.daniweb.com/forums/forum8.html)
-   -   Don't Erase Contents of Text File (http://www.daniweb.com/forums/thread165838.html)

cppnewb Jan 3rd, 2009 12:34 pm
Don't Erase Contents of Text File
 
Hi, It's me again with another silly question:)
I was wondering if there was a way using ofstream to not erase the contents of the file it is writing to and simply write at the end.
Thanks!
P.S. I'm using windows XP and Dev C++

Freaky_Chris Jan 3rd, 2009 12:42 pm
Re: Don't Erase Contents of Text File
 
ofstream myfile("example.txt", std::ios::app);
Hope that helps :P
app stands for append btw

Chris

cppnewb Jan 3rd, 2009 12:51 pm
Re: Don't Erase Contents of Text File
 
Thanks

Freaky_Chris Jan 3rd, 2009 12:52 pm
Re: Don't Erase Contents of Text File
 
Your Welcome,
Go ahead and mark this as solved.

Chris


All times are GMT -4. The time now is 8:40 am.

Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC