FCLOSE(3S)FCLOSE(3S)NAME
fclose, fflush - close or flush a stream
SYNOPSIS
#include <stdio.h>
int fclose(FILE *stream);
int fflush(FILE *stream);
DESCRIPTION
Fclose causes any buffers for the named stream to be flushed, and the
file to be closed. Buffers allocated by the standard input/output
system are freed.
Fclose is performed automatically upon calling exit(3).
Fflush causes any buffered data for the named output or update stream
to be written to that file. The stream remains open.
If stream is a null pointer, the fflush function performs this flushing
action on all output and update streams.
RETURN VALUE
Fclose and fflush return EOF for unsuccessful calls and store an error
code in errno, otherwise returning zero.
ERRORS
The underlying functions of fclose are write(2) and close(2). The
underlying functions of fflush are write(2) and lseek(2). The error
conditions specified for these functions apply to fclose and fflush.
SEE ALSOwrite(2), close(2), lseek(2), fopen(3S), setbuf(3S)
August 1, 1992 FCLOSE(3S)