This documentation is copyright © 1998-2001 Sandro Sigala <sandro@sigala.it>.
All rights reserved.
Released under the GNU General Public License.
fflush
Prototype
#include <stdio.h>
int fflush(FILE *stream);
Description
Flushes the write buffers of the stream pointed to by stream
, so that
any unwritten data is actually written to the file. If the stream
parameter is NULL
, the fflush
function flushes the write
buffers of all the open streams.
Example
#include <stdio.h>
#include <stdlib.h>
#define MAXLINELEN 1024
int main(void)
{
char buf[MAXLINELEN];
printf("What is your name? ");
fflush(stdout);
fgets(buf, MAXLINELEN, stdin);
printf("You wrote %s", buf);
return EXIT_SUCCESS;
}
References
ISO C 9899:1990 7.9.5.2