#include <stdio.h>int fclose(FILE *stream);
The fclose( ) function closes the file associated with stream and flushes its buffer. After a call to fclose( ), stream is no longer connected with the file, and any automatically allocated buffers are deallocated.
If fclose( ) is successful, zero is returned; otherwise, EOF is returned. Trying to close a file that has already been closed is an error. Removing the storage media before closing a file will also generate an error, as will lack of sufficient free disk space.
Related functions are fopen( ), freopen( ), and fflush( ).