NAME

fclose, fflush - close or flush a stream

SYNOPSIS

#include <stdio_p.h>

int fclose (stream)
FILE *stream;

int fflush (stream)
FILE *stream;

DESCRIPTION

fclose causes any buffers for the named stream to be emptied, and the file to be closed. Buffers allocated by the standard input/output system are freed.

fclose is performed automatically upon calling exit(2P).

fflush causes any buffered data for the named output stream to be written to that file. It does not update the i-node that describes the file. The stream remains open.

These functions return 0 for success, and EOF if any errors were detected.

SEE ALSO

sync(2F) , close(2P) , fopen(3P) , setbuf(3P).