fflush(3C)
_________________________________________________________________
fflush function
Flush the output buffer of the specified stream.
_________________________________________________________________
Calling Sequence
#include <stdio.h>
FILE *fp;
int fflush();
...
fflush(fp);
where fp is a pointer to a stream.
Description
The fflush function flushes the output buffer of the stream you
specify. It assumes that the file is open. "Returns" The fflush
function returns -1 if an error occurs; otherwise it returns 0.
Related Functions
See also the fclose and freopen functions.
Example
/* Program test for the fflush() function */
#include <stdio.h>
int fflush();
main(argc, argv)
int argc;
char *argv[];
{
int i;
for (i = 1; i < argc; i++)
printf("%s_", argv[i]);
fflush(stdout); /* Ensure characters written */
/* out before sleeping. */
sleep(2 * 60); /* Go to sleep for 2 minutes. */
}
A call to the program test with the arguments a, b, c, d, e, and
f generates the output
DG/UX 4.00 Page 1
Licensed material--property of copyright holder(s)
fflush(3C)
a_b_c_d_e_f_
before going to sleep for 2 minutes.
DG/UX 4.00 Page 2
Licensed material--property of copyright holder(s)