1fpurge(3) Library Functions Manual fpurge(3)
2
3
4
6 fpurge, __fpurge - purge a stream
7
9 Standard C library (libc, -lc)
10
12 /* unsupported */
13 #include <stdio.h>
14
15 int fpurge(FILE *stream);
16
17 /* supported */
18 #include <stdio.h>
19 #include <stdio_ext.h>
20
21 void __fpurge(FILE *stream);
22
24 The function fpurge() clears the buffers of the given stream. For out‐
25 put streams this discards any unwritten output. For input streams this
26 discards any input read from the underlying object but not yet obtained
27 via getc(3); this includes any text pushed back via ungetc(3). See
28 also fflush(3).
29
30 The function __fpurge() does precisely the same, but without returning
31 a value.
32
34 Upon successful completion fpurge() returns 0. On error, it returns -1
35 and sets errno to indicate the error.
36
38 EBADF stream is not an open stream.
39
41 For an explanation of the terms used in this section, see at‐
42 tributes(7).
43
44 ┌────────────────────────────────┬───────────────┬─────────────────────┐
45 │Interface │ Attribute │ Value │
46 ├────────────────────────────────┼───────────────┼─────────────────────┤
47 │__fpurge() │ Thread safety │ MT-Safe race:stream │
48 └────────────────────────────────┴───────────────┴─────────────────────┘
49
51 None.
52
54 fpurge()
55 4.4BSD. Not available under Linux.
56
57 __fpurge()
58 Solaris, glibc 2.1.95.
59
61 Usually it is a mistake to want to discard input buffers.
62
64 fflush(3), setbuf(3), stdio_ext(3)
65
66
67
68Linux man-pages 6.05 2023-07-20 fpurge(3)