fclose, fflush - close or flush a stream
#include <stdio.h>
fclose() causes any buffered data waiting to be written for the named stream to be written out, and the stream to be closed. If the underlying file pointer is not already at end of file, and the file is one capable of seeking, the file pointer is adjusted so that the next operation on the open file pointer deals with the byte after the last one read from or written to the file being closed.
If stream points to an output stream or an update stream on which the most recent operation was not input, fflush() causes any buffered data waiting to be written for the named stream to be written to that file. Any unread data buffered in stream is discarded. The stream remains open. If stream is open for reading, the underlying file pointer is not already at end of file, and the file is one capable of seeking, the file pointer is adjusted so that the next operation on the open file pointer deals with the byte after the last one read from or written to the stream.
Note that Unison's fflush() does not support flushing all open files with a NULL parameter.
Upon successful completion, these functions return 0; otherwise, they return EOF and set errno to indicate the error.
These functions are members of Unison's STDIO implementation. The STDIO implementation rests on top of IOLIB and inherits IOLIB's dependency on each specific server to report an appropriate error code for its usage.
For an exact list of error codes returned by a particular server, refer to that server's documentation in the Unison Programmer's Guide for each specific platform.
Servers may implement these errors codes in response to this function.
These functions will fail if: