how can I reopen a file later in a program and ot erase everything in it???????
Ofstream doesn't work it erases everything
Printable View
how can I reopen a file later in a program and ot erase everything in it???????
Ofstream doesn't work it erases everything
Code:
#include <fstream.h>
int main(void)
{
const char FILE_NAME[]="Test.txt";
fstream File( FILE_NAME, ios::in || ios::out );
return 0;
}
Yes it does, just give ios::app flag to it.Quote:
Originally posted by kas2002
Ofstream doesn't work it erases everything
Code:ofstream output("code.cpp",ios::app);