C – Fclose

C – Fclose 2017-06-12T13:07:35+00:00


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:

Prev Next