logo
Closing a file In C Language
• fclose() function is used to releases the memory stream, opened by fopen().
• The fclose() function is used to close an already opened file.
• A file must be closed as soon as all operations on it have been completed. This would close the file associated with the file pointer.
• The input output library supports the function to close a file; it is in the following format.

Syntax :
int fclose( FILE * stream );

Return valu e :

Here fclose() function closes the file and returns zero on success, or EOF if there is an error in closing the file. This EOF is a constant defined in the header file stdio.h.
  Example :
#include<stdio.h>
int main()
{
    FILE *fp;
    fp = fopen(“fileName.txt” ,”w”);
    fclose(fp);
    return 0; 
}