I'm constantly calling a function which is writing to a text file, but each time I call the function, it overwrites the existing text file.
Is there a way to add the text to the end of the text file instead of overwriting it each time?
I'm constantly calling a function which is writing to a text file, but each time I call the function, it overwrites the existing text file.
Is there a way to add the text to the end of the text file instead of overwriting it each time?
Yes, open the file with the "a" mode for appending instead of "w" which truncates the file for overwriting.
My best code is written with the delete key.
http://www.hmug.org/man/3/fopen.php
Mode "a"
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.