Next Previous Contents

35. fflush

Synopsis

Flush an output stream

Usage

Integer_Type fflush (File_Type fp)

Description

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.

Example

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

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

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