Reading a file. Copying over to other file. Renaming. Renaming = -1?

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

Join Date: Nov 2008
Posts: 91
Reputation: brechtjah is an unknown quantity at this point 
Solved Threads: 9
brechtjah's Avatar
brechtjah brechtjah is offline Offline
Junior Poster in Training

Re: Reading a file. Copying over to other file. Renaming. Renaming = -1?

 
0
  #11
Nov 20th, 2008
Originally Posted by Lokolo View Post
1. No I thought it would overwrite it (like if you try to open a file, if it doesn't exist, it creates one)... guess it doesn't. Will look up file delete later (I funnily enough have a C++ tutorial now)
You're declaring an ofstream with the append flag (ios::app) which appends to the file, opens it and adds text instead of overwriting the content. Try it out without that flag, see what happens.

  1. ofstream tempfile ("tempfile.txt", ios::app);
Reply With Quote Quick reply to this message  
Reply

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



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



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

©2003 - 2009 DaniWeb® LLC