fopen - clear/truncate file in C when already open in "r+" mode - Stack Overflow
My code currently looks something like this (these steps splitted into multiple functions): /* open file */ FILE *file = fopen(filename, "r+"); if(!file) { /* read the file */ /* modify the... ... With standard C, the only way is to reopen the file in "w+...