Hi, I need to know how to erase the contents a text file after I have written to it, using ofstream.
Thanks
Hi, I need to know how to erase the contents a text file after I have written to it, using ofstream.
Thanks
The default behavior on opening a file with ios:ut is to create it if it doesn't exist, and delete the contents if it does. So you could close the file then reopen it.
You can also use ios::trunc to delete the contents.
The smiley should be ios::out
C++ Is Powerful
I use C++
There fore I am Powerful