#include <fstream>

Write your question here.
Is it possible to store into a text file without overwriting the existing information?

ofstream outf;

int x;

int main ()
outf.open (''.......'');
cout <<''Enter Desire Digit''<<endl;
cin >>x;

outf <<x<<endl;
return 0;
Use the append parameter.

std::ofstream outFile( "filename.txt", ios::app );

Yes. Pass the ate (or app) flag when opening the stream.

outf.open (".......", ios::ate);
Last edited on
Thanks guys, the 'app' worked but 'ate' didnt
Topic archived. No new replies allowed.