Don't Erase Contents of Text File

Please support our C++ advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2009
Posts: 46
Reputation: cppnewb is an unknown quantity at this point 
Solved Threads: 0
cppnewb's Avatar
cppnewb cppnewb is offline Offline
Light Poster

Don't Erase Contents of Text File

 
0
  #1
Jan 3rd, 2009
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++
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: Don't Erase Contents of Text File

 
0
  #2
Jan 3rd, 2009
  1. ofstream myfile("example.txt", std::ios::app);
Hope that helps
app stands for append btw

Chris
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 46
Reputation: cppnewb is an unknown quantity at this point 
Solved Threads: 0
cppnewb's Avatar
cppnewb cppnewb is offline Offline
Light Poster

Re: Don't Erase Contents of Text File

 
0
  #3
Jan 3rd, 2009
Thanks
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 670
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: Don't Erase Contents of Text File

 
0
  #4
Jan 3rd, 2009
Your Welcome,
Go ahead and mark this as solved.

Chris
Knowledge is power -- But experience is everything
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC