1fflush(3C)               Standard C Library Functions               fflush(3C)
2
3
4

NAME

6       fflush - flush a stream
7

SYNOPSIS

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

DESCRIPTION

15       If  stream  points to an output stream or an update stream in which the
16       most recent operation was not input, fflush() causes any unwritten data
17       for  that  stream  to  be  written  to  the  file, and the st_ctime and
18       st_mtime fields of the underlying file are marked for update.
19
20
21       If stream points to an input stream or an update stream into which  the
22       most  recent operation was input, that stream is flushed if it is seek‐
23       able and is not already at end-of-file.  Flushing an input stream  dis‐
24       cards  any  buffered  input  and adjusts the file pointer such that the
25       next input operation accesses the byte after  the  last  one  read.   A
26       stream  is seekable if the underlying file is not a pipe, FIFO, socket,
27       or TTY device.
28
29
30       If stream is a null pointer, fflush() performs this flushing action  on
31       all streams for which the behavior is defined above.
32
33
34       An input stream, seekable or non-seekable, can be flushed by explicitly
35       calling fflush() with a non-null argument specifying that stream.
36

RETURN VALUES

38       Upon successful completion, fflush() returns 0. Otherwise,  it  returns
39       EOF and sets errno to indicate the error.
40

ERRORS

42       The fflush() function will fail if:
43
44       EAGAIN    The O_NONBLOCK flag is set for the file descriptor underlying
45                 stream and the process would be delayed in the  write  opera‐
46                 tion.
47
48
49       EBADF     The file descriptor underlying stream is not valid.
50
51
52       EFBIG     An  attempt was made to write a file that exceeds the maximum
53                 file size or the process's file size limit; or the file is  a
54                 regular  file  and  an attempt was made to write at or beyond
55                 the offset maximum associated with the corresponding stream.
56
57
58       EINTR     The fflush() function was interrupted by a signal.
59
60
61       EIO       The process  is  a  member  of  a  background  process  group
62                 attempting  to  write  to its controlling terminal, TOSTOP is
63                 set, the process is neither ignoring  nor  blocking  SIGTTOU,
64                 and the process group of the process is orphaned.
65
66
67       ENOSPC    There  was  no  free space remaining on the device containing
68                 the file.
69
70
71       EPIPE     An attempt is made to write to a pipe or  FIFO  that  is  not
72                 open  for  reading by any process. A SIGPIPE signal will also
73                 be sent to the calling process.
74
75
76
77       The fflush() function may fail if:
78
79       ENXIO    A request was made of a non-existent device,  or  the  request
80                was beyond the limits of the device.
81
82

ATTRIBUTES

84       See attributes(5) for descriptions of the following attributes:
85
86
87
88
89       ┌─────────────────────────────┬─────────────────────────────┐
90       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
91       ├─────────────────────────────┼─────────────────────────────┤
92       │Interface Stability          │Standard                     │
93       ├─────────────────────────────┼─────────────────────────────┤
94       │MT-Level                     │MT-Safe                      │
95       └─────────────────────────────┴─────────────────────────────┘
96

SEE ALSO

98       getrlimit(2), ulimit(2), attributes(5), standards(5)
99
100
101
102SunOS 5.11                        1 Nov 2003                        fflush(3C)
Impressum