fclose
Closes a stream file
#include <stdio.h>
int fclose (
FILE *fp);
The fclose function returns a value of 0 if the file was successfully closed or nonzero if any errors were detected. When an error has occurred, errno is set.
This function also works on the DOS partition.
The fclose function closes the file pointed to by fp. If there is unwritten buffered data for the file, it is written before the file is closed. Unread buffered data is discarded. If the associated buffer was automatically allocated, it is deallocated.