fclose(S) 6 January 1993 fclose(S) Name fclose, fflush - close or flush a stream Syntax cc . . . -lc #include <stdio.h> int fclose (stream) FILE *stream; int fflush (stream) FILE *stream; Description The fclose function causes any buffered data for the named stream to be written out, and the stream to be closed. The fclose function is performed automatically for all open files upon calling exit. fflush causes any buffered data for the named stream to be written to that file. The stream remains open. Diagnostics These functions return 0 for success and EOF if any error (such as trying to write to a file that has not been opened for writing) was detected. See also close(S), exit(S), fopen(S), setbuf(S), stdio(S) Standards conformance fclose and fflush are conformant with: AT&T SVID Issue 2; X/Open Portability Guide, Issue 3, 1989; ANSI X3.159-1989 Programming Language -- C; Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2); IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1); and NIST FIPS 151-1.