Hello,
I am doing one project. I am using fstream liabrary for reading and writing text in to files.
I am able to write text in file.but when I execute it, next time it overwrite the contents of the last time execution.
so, i want to add the text keeping previously added content saved.
currently previously added contents are lost when executing the program.
Can any one help me regarding this ?
I am beginner to C++.and I have not much expertice in C++.
when you open the file, after the file name add ios::app like this: ofstream outfile("thefile.txt", ios::app);
That opens the file in append mode, so it doesn't get overwritten.