fclose(3s)
NAME
fclose, fflush − close or flush a stream
SYNTAX
#include <stdio.h>
int fclose(stream)
FILE *stream;
int fflush(stream)
FILE *stream;
DESCRIPTION
The fclose subroutine causes any buffers for the named stream to be written out and then closes the stream. Buffers allocated by the standard input/output system are freed.
The fclose subroutine is performed automatically upon calling exit(2).
The fflush subroutine causes any buffered data for the named output stream to be written to that file. The stream remains open.
DIAGNOSTICS
These routines return EOF if stream is not associated with an output file, or if buffered data cannot be transferred to that file.