Guardian C Library Calls Reference Manual

Reference to Library Calls
Guardian TNS C Library Calls Reference Manual128833 3-41
fflush
fflush
The fflush function writes to disk any data that is in the buffer of a file opened for
ANSI I/O.
stream
denotes a file opened for ANSI I/O.
Return Value
is zero if the operation is successful or nonzero if an error occurs.
Usage Guidelines
If you pass NULL as the argument to fflush, the C compiler flushes all files
currently opened for ANSI I/O.
In C-series releases, the fflush function can flush partial lines if stdout and stderr are
directed to type 101 Edit files. In D-series releases, the fflush function does not flush
partial lines if stdout and stderr are directed to type 101 Edit tiles because these files
are shared resources under the CRE.
In D-series releases, to flush partial lines to the stdout and stderr files, you must
either open the files using freopen or close and reopen the files using fopen. In both
cases, these files cannot be shared.
Example
This example writes all buffered data for the file $a.b.c to disk:
#include <stdioh>
FILE *fp;
fp = fopen("$a.b.c", "a");
/* ... */
fflush(fp);
#include <stdioh>
int fflush(FILE *stream);