fclose

Closes a stream file

Local Servers:blocking
Remote Servers:blocking
Classification:ANSI
Platform:NLM
Service:Stream I/O

Syntax

  #include <stdio.h>  
   
  int fclose  (  
     FILE   *fp);
  

Parameters

fp
(IN) Points to the file to close.

Return Values

The fclose function returns a value of 0 if the file was successfully closed or nonzero if any errors were detected. When an error has occurred, errno is set.

Remarks

This function also works on the DOS partition.

The fclose function closes the file pointed to by fp. If there is unwritten buffered data for the file, it is written before the file is closed. Unread buffered data is discarded. If the associated buffer was automatically allocated, it is deallocated.

See Also

fcloseall, fdopen, fopen, freopen