How do I clear the whole contents of a file in C?
As @stefan said using fopen() with “w” mode will do the job for you. When you open a file with “w” flag it creates an empty file for writing. If a file with the same name already exists its contents are erased and the file is treated as an empty new file. If the file … Read more