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(). See also
25 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 These functions are nonstandard and not portable. The function
39 fpurge() was introduced in 4.4BSD and is not available under Linux.
40 The function __fpurge() was introduced in Solaris, and is present in
41 glibc 2.1.95 and later.
42
44 Usually it is a mistake to want to discard input buffers.
45
47 fclean(3), fflush(3), setbuf(3), stdio_ext(3)
48
49
50
51 2001-12-15 FPURGE(3)