fclose
(3)close a stream
#include <stdio.h> int fclose(FILE *stream);
LIBRARY
DESCRIPTION
The fclose() function flushes the stream pointed to by stream (writing any buffered output data using fflush(3)) and closes the underlying file descriptor.
The behaviour of fclose() is undefined if the stream parameter is an illegal pointer, or is a descriptor already passed to a previous invocation of fclose().
RETURN VALUE
ERRORS
- EBADF
- The file descriptor underlying stream is not valid.
The fclose() function may also fail and set errno for any of the errors specified for the routines close(2), write(2), or fflush(3).