943,810 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Marked Solved
  • Views: 899
  • C++ RSS
Jan 3rd, 2009
0

Don't Erase Contents of Text File

Expand Post »
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++
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cppnewb is offline Offline
52 posts
since Jan 2009
Jan 3rd, 2009
0

Re: Don't Erase Contents of Text File

C++ Syntax (Toggle Plain Text)
  1. ofstream myfile("example.txt", std::ios::app);
Hope that helps
app stands for append btw

Chris
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008
Jan 3rd, 2009
0

Re: Don't Erase Contents of Text File

Thanks
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cppnewb is offline Offline
52 posts
since Jan 2009
Jan 3rd, 2009
0

Re: Don't Erase Contents of Text File

Your Welcome,
Go ahead and mark this as solved.

Chris
Reputation Points: 325
Solved Threads: 118
Master Poster
Freaky_Chris is offline Offline
702 posts
since Apr 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: STL list question
Next Thread in C++ Forum Timeline: Cant solve what is wrong





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC