cplusplus.com cplusplus.com
cplusplus.com   C++ : Forums : Beginners : Writing to files
  Search:
- -
C++
Information
Documentation
Reference
Articles
Sourcecode
Forums
Forums
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Articles
Lounge
Jobs

-

post  Writing to files

gsingh2011 (24)
I just learned how to write to a file, but when I do this, it completely erases the file and writes what you want. Is there any way of writing something to a text file, closing it, and then adding some more to it without erasing what was already in it?
|
firedraco (367)
Try using:
streamname.open ("filename.txt", fstream::in | fstream::app); //fstream::app means "append"
|

This topic is archived - New replies not allowed.
Home page | Privacy policy
© cplusplus.com, 2000-2008 - All rights reserved - v2.2
Spotted an error? contact us