Alf said:
* marcia:
You can seek to the end of the file, and with e.g. ofstream you can specify
that in the constructor.
Specifically, you can do it like this via the constructor:
#include <fstream>
using namespace std;
int main()
{
ofstream file( "myfile.txt", ios_base::ate );
file << "This text will appear at the end of the file." << endl;
return 0;
}
or like this via the seekp method:
#include <fstream>
using namespace std;
int main()
{
ofstream file( "myfile.txt" );
file.seekp( 0, ios_base::end );
file << "This text will appear at the end of the file." << endl;
return 0;
}
You can get more details at
http://www.cplusplus.com/ref/iostream/fstream/
Cheers! --M