fclose, fflush - close or flush a stream
fclose() writes out any buffered data for the named stream, and closes
the named stream. Buffers allocated by the standard input/output sys-
tem are freed.
fclose() is performed automatically for all open files upon calling
fflush() writes any unwritten data for an output stream or an update
stream in which the most recent operation was not input to be delivered
to the host environment to the file; otherwise it is ignored. The
named stream remains open.
SYSTEM V DESCRIPTION
When fflush() is called on a stream opened for reading, any unread
data buffered in the stream is invalidated. When fflush() is called on
a stream opened for reading, if the file is not already at EOF, and the
file is one capable of seeking, the file offset of the underlying open
file description is adjusted so the next operation on the open file
description deals with the byte after the last byte read from or writ-
ten to the stream being flushed.
fclose() and fflush() return:
0 on success.
EOF if any error (such as trying to write to a file that has not
been opened for writing) was detected.
close(2V), exit(3), fopen(3V), setbuf(3V)
22 January 1990 FCLOSE(3V)