Declaration: 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.
For example, the following code opens and close a file:
If((fptr = fopen(“TEST”,”w”))==NULL)
printf(“Cannot open file\n”);
pritf(“File close error\n”);