Name
flushall - Writes buffer contents to files and clears
buffers.
Syntax
#include <stdio.h>
int flushall(void)
Description
The flushall function writes the contents of all buffers
associated with the open output streams to their associated
files. All buffers associated with open input streams are
cleared of their current contents; the next read operation
(if there is one) then reads new data from the input files
into the buffers.
Buffers are automatically flushed when they are full, when
streams are closed, or when a program terminates normally
without closing streams.
All streams remain open after the call to flushall.
Return Value
The flushall function returns the number of open streams
(input and output). There is no error return.
See Also
fflush(S)
Example
#include <stdio.h>
main()
{
int numflushed;
numflushed = flushall();
printf("There were %d streams flushed\n",
numflushed);
}
This program uses flushall to flush all buffers, including
stdin, stdout, and stderr, and prints the number of open
streams.
(printed 6/18/89)