Hello, my question is how to clear the file's previous text, so when I start writing to the file it will be empty and there will be no overwriting? I know how to clear screen (I've seen this on forum), but I don't know this for the file. My file is for input and output. Thanks, Franjo
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I suggest you read up on file modes ie. read, write, read/write, append etc. If your using C, study up on FILE* (file pointers), or fstream for C++(but i'd leave that for the momment).
LK
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello, my question is how to clear the file's previous text, so when I start writing to the file it will be empty and there will be no overwriting? I know how to clear screen (I've seen this on forum), but I don't know this for the file. My file is for input and output. Thanks, Franjo
I suggest you read up on file modes ie. read, write, read/write, append etc. If your using C, study up on FILE* (file pointers), or fstream for C++(but i'd leave that for the momment).
LK
By default when opening a file ( ofstream fout("test.txt") ) it is deleated and replaced if it already exists.
Curtis