1FFLUSH(3)                  Linux Programmer's Manual                 FFLUSH(3)
2
3
4

NAME

6       fflush - flush a stream
7

SYNOPSIS

9       #include <stdio.h>
10
11       int fflush(FILE *stream);
12

DESCRIPTION

14       For  output streams, fflush() forces a write of all user-space buffered
15       data for the given output or update stream via the stream's  underlying
16       write function.  For input streams, fflush() discards any buffered data
17       that has been fetched from the underlying file, but has not been by the
18       application.  The open status of the stream is unaffected.
19
20       If  the  stream  argument  is  NULL,  fflush()  flushes all open output
21       streams.
22
23       For a nonlocking counterpart, see unlocked_stdio(3).
24

RETURN VALUE

26       Upon successful completion 0 is returned.  Otherwise, EOF  is  returned
27       and errno is set to indicate the error.
28

ERRORS

30       EBADF  Stream is not an open stream, or is not open for writing.
31
32       The function fflush() may also fail and set errno for any of the errors
33       specified for write(2).
34

CONFORMING TO

36       C89, C99, POSIX.1-2001, POSIX.1-2008.
37
38       The standards do not specify the  behavior  for  input  streams.   Most
39       other implementations behave the same as Linux.
40

NOTES

42       Note  that fflush() only flushes the user space buffers provided by the
43       C library.  To ensure that the data is physically stored  on  disk  the
44       kernel  buffers  must  be  flushed  too,  for  example, with sync(2) or
45       fsync(2).
46

SEE ALSO

48       fsync(2),   sync(2),   write(2),   fclose(3),   fopen(3),    setbuf(3),
49       unlocked_stdio(3)
50

COLOPHON

52       This  page  is  part of release 3.25 of the Linux man-pages project.  A
53       description of the project, and information about reporting  bugs,  can
54       be found at http://www.kernel.org/doc/man-pages/.
55
56
57
58GNU                               2009-09-06                         FFLUSH(3)
Impressum