-
fstream.
Hmm, im right now working with a server/client application.
May i know which ios::... to use to actually make it save into the file and keep the old text in it too...
Normally, when you write new text, it directly deletes the text that were in the files.
Thank you.
-
-
>>Normally, when you write new text, it directly deletes the text that were in the files.
actually unless you specify "std::ios::trunc" then it deletes the file, and makes a new one.
-
I think this table is most helpful in telling the file modes exactly. It conpares c++ open modes with c open modes
Code:
Table 33: Open modes and their C stdio counterparts
Open Mode C stdio Equivalent Effect
in - "r" Open text file for reading only
out|trunc or out - "w" Truncate to 0 length, if existent, or create text file for writing only
out|app - "a" Append; open or create text file only for writing at end of file
in|out - "r+" Open text file for update (reading and writing)
in|out|trunc - "w+" Truncate to 0 length, if existent, or create text file for update
in|out|app - "a+" - Append; open or create text file for update, writing at end of file
http://stdcxx.apache.org/doc/stdlibug/30-3.html