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:
I’ve been working on a few coding projects lately, and I realized that no matter how much you focus on your code, the little write-ups, comments, and documentation always end up full of tiny mistakes. It’s surprisingly distracting when you’re trying to make sense of your own notes later. I started using this proofreading tool I found—https://cabina.ai/tools/text-enhancer it actually catches things I’d completely overlook, like awkward phrasing or missing punctuation. It doesn’t feel like overkill, just smooths out your text so you can focus more on the coding itself. Definitely saved me some headaches.
Last edit: Viki Denver 2026-01-24
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
I’ve been working on a few coding projects lately, and I realized that no matter how much you focus on your code, the little write-ups, comments, and documentation always end up full of tiny mistakes. It’s surprisingly distracting when you’re trying to make sense of your own notes later. I started using this proofreading tool I found—https://cabina.ai/tools/text-enhancer it actually catches things I’d completely overlook, like awkward phrasing or missing punctuation. It doesn’t feel like overkill, just smooths out your text so you can focus more on the coding itself. Definitely saved me some headaches.
Last edit: Viki Denver 2026-01-24