int fclose (FILE *stream);
The fclose function closes the file associated with stream and flushes its buffer (i.e., it writes any data still remaining in the disk buffer to the file). After a call to fclose(), stream is no longer connected with the file, and any automatically allocated buffers are de allocated.
If fclose () is successful, zero is returned; otherwise EOF is returned.
C – FCLOSE FUNCTION EXAMPLE PROGRAM :
if((fptr = fopen(“TEST”,”w”))==NULL)
printf(“Cannot open file\n”);
printf(“File close error\n”);