Section: Linux Programmer's Manual (3)
Return to Main Contents
fclose - close a stream
int fclose(FILE *fp);
function flushes the stream pointed to by
(writing any buffered output data using
and closes the underlying file descriptor.
The behaviour of
is undefined if the
parameter is an illegal pointer, or is a descriptor already passed
to a previous invocation of
Upon successful completion 0 is returned.
is returned and the global variable
is set to indicate the error.
In either case any further access
(including another call to
to the stream results in undefined behavior.
The file descriptor underlying
is not valid.
function may also fail and set
for any of the errors specified for the routines
only flushes the user space buffers provided by the
To ensure that the data is physically stored
on disk the kernel buffers must be flushed too, for example, with
This page is part of release 3.27 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.