overwriting a specific line on a text file?
问题 how do I go about overwriting a specific line on a text file in c?. I have values in multiple variables that need to be written onto the file. 回答1: This only works when the new line has the same size as the old one: Open the file in the mode a+ fseek() to the start of the file Before reading the next line, use ftell() to note the start of the line Read the line If it's the line you want, fseek() again with the result from ftell() and use fwrite() to overwrite it. If the length of the line