[Resolved] File Writing Help
I have this function:
Code:
void addmovie() {
char string[50] = {'\0'};
ofstream outFile("C:\\test.txt", ios::out);
if (!outFile) {
cout << "File could not be opened!" << endl;
exit(0);
}
cout << "String: ";
cin.ignore();
cin.getline(string, 50, '\n');
//outFile.seekp(outFile.eof());
outFile << string;
outFile << '\n';
}
How can I make it output at the end of the file, rather than overwriting it?
I thought about reading the file, and adding to it, then writing it back...but is there any other way?