1FPURGE(3) Linux Programmer's Manual FPURGE(3)
2
3
4
6 fpurge, __fpurge - purge a stream
7
9 /* unsupported */
10 #include <stdio.h>
11
12 int fpurge(FILE *stream);
13
14 /* supported */
15 #include <stdio.h>
16 #include <stdio_ext.h>
17
18 void __fpurge(FILE *stream);
19
21 The function fpurge() clears the buffers of the given stream. For out‐
22 put streams this discards any unwritten output. For input streams this
23 discards any input read from the underlying object but not yet obtained
24 via getc(3); this includes any text pushed back via ungetc(3). See
25 also fflush(3).
26
27 The function __fpurge() does precisely the same, but without returning
28 a value.
29
31 Upon successful completion fpurge() returns 0. On error, it returns -1
32 and sets errno appropriately.
33
35 EBADF stream is not an open stream.
36
38 For an explanation of the terms used in this section, see
39 attributes(7).
40
41 ┌───────────┬───────────────┬─────────────────────┐
42 │Interface │ Attribute │ Value │
43 ├───────────┼───────────────┼─────────────────────┤
44 │__fpurge() │ Thread safety │ MT-Safe race:stream │
45 └───────────┴───────────────┴─────────────────────┘
46
48 These functions are nonstandard and not portable. The function
49 fpurge() was introduced in 4.4BSD and is not available under Linux.
50 The function __fpurge() was introduced in Solaris, and is present in
51 glibc 2.1.95 and later.
52
54 Usually it is a mistake to want to discard input buffers.
55
57 fflush(3), setbuf(3), stdio_ext(3)
58
60 This page is part of release 4.16 of the Linux man-pages project. A
61 description of the project, information about reporting bugs, and the
62 latest version of this page, can be found at
63 https://www.kernel.org/doc/man-pages/.
64
65
66
67 2017-09-15 FPURGE(3)