Next Previous Contents

35. fflush


Flush an output stream


Integer_Type fflush (File_Type fp)


The fflush function may be used to update the output stream specified by fp. It returns 0 upon success, or -1 upon failure and sets errno accordingly. In particular, this function will fail if fp does not represent an output stream, or if fp is associated with a disk file and there is insufficient disk space.


This example illustrates how to use the fflush function without regard to the return value:

    () = fputs ("Enter value> ", stdout);
    () = fflush (stdout);

Many C programmers disregard the return value from the fflush function. The above example illustrates how to properly do this in the S-lang langauge.

See Also

fopen, fclose

Next Previous Contents