| 1 | .TH FCLOSE 3S |
| 2 | .SH NAME |
| 3 | fclose, fflush \- close or flush a stream |
| 4 | .SH SYNOPSIS |
| 5 | .B #include <stdio.h> |
| 6 | .PP |
| 7 | .B fclose(stream) |
| 8 | .br |
| 9 | .SM |
| 10 | .B FILE |
| 11 | .B *stream; |
| 12 | .PP |
| 13 | .B fflush(stream) |
| 14 | .br |
| 15 | .SM |
| 16 | .B FILE |
| 17 | .B *stream; |
| 18 | .SH DESCRIPTION |
| 19 | .I Fclose |
| 20 | causes any buffers for the named |
| 21 | .I stream |
| 22 | to be emptied, and the file to be closed. |
| 23 | Buffers allocated by the standard input/output system |
| 24 | are freed. |
| 25 | .PP |
| 26 | .I Fclose |
| 27 | is performed automatically upon |
| 28 | calling |
| 29 | .IR exit (2). |
| 30 | .PP |
| 31 | .I Fflush |
| 32 | causes any buffered data for the named output |
| 33 | .I stream |
| 34 | to be written to that file. |
| 35 | The stream remains open. |
| 36 | .SH "SEE ALSO" |
| 37 | close(2), |
| 38 | fopen(3), |
| 39 | setbuf(3) |
| 40 | .SH DIAGNOSTICS |
| 41 | These routines return |
| 42 | .SM |
| 43 | .B EOF |
| 44 | if |
| 45 | .I stream |
| 46 | is not associated with an output file, or |
| 47 | if buffered data cannot be transferred to that file. |