View Single Post
  #9   Spotlight this post!  
Unread 19-02-2013, 21:09
mmavipc mmavipc is offline
Registered User
FRC #1622
 
Join Date: Jan 2012
Location: California
Posts: 6
mmavipc is an unknown quantity at this point
Re: Printing to a text file

Quote:
Originally Posted by Toa Circuit View Post
Using ofstream is fine... but one thing. When you create or open ofstream objects, the file is cleared out.
Open it with std::ios_base::app

Code:
std::ofstream::open("filename.txt", std::ios_base::out | std::ios_base::app);
It will append to the file instead of truncating it.
Reply With Quote