Concept

How should you close files in C?

ComputerScienceOne / Closing Files

"Once you are done processing a file, you should close it using the fclose() function:\n\nint fclose(FILE *fp);\n\nwhich takes a single argument, the FILE pointer of the file you wish to close. Closing an invalid file may result in an error or segmentation fault. In any case, after a file has been closed, it cannot be read from or written to, doing so is undefined behavior. Failure to close a file may result in a corrupted file."

Related Ideas

How should you close files in C? | ComputerScienceOne | Bifalgorithm | Bifalgorithm