Name | Description | Notes | Source | Availability | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
fclose() |
Close stream | (·) | <stdio.h> |
C89 | C90 | C95 | C99 | C11 | |||
fflush() |
Flush stream | (·) | <stdio.h> |
C89 | C90 | C95 | C99 | C11 |
#include <stdio.h>
int fflush(FILE *stream);
int fclose(FILE *stream);
fflush
flushes the buffers of an output stream. This is useful if you want to
print out debugging information just before a program is
expected to crash; the crash may cause buffered data to be
lost.
A stream should be closed after use, ensuring that all
data have been properly written. fclose
takes a stream, flushes it, and closes it. The FILE *
handle is invalid after that
point and cannot be used again.
All streams are closed when the program terminates normally.