Debian Codegraph @

upstream/debian-unstable/man3/fpurge.3

raw
1 '\" t
2 .\" Copyright 2001, Andries E. Brouwer <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH fpurge 3 2026-02-08 "Linux man-pages 6.18"
8 .SH NAME
9 fpurge, __fpurge \- purge a stream
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 /* unsupported */
16 .B #include <stdio.h>
17 .P
18 .BI "int fpurge(FILE *" stream );
19 .P
20 /* supported */
21 .B #include <stdio.h>
22 .B #include <stdio_ext.h>
23 .P
24 .BI "void __fpurge(FILE *" stream );
25 .fi
26 .SH DESCRIPTION
27 The function
28 .BR fpurge ()
29 clears the buffers of the given stream.
30 For output streams this discards any unwritten output.
31 For input streams this discards any input read from the underlying object
32 but not yet obtained via
33 .BR getc (3);
34 this includes any text pushed back via
35 .BR ungetc (3).
36 See also
37 .BR fflush (3).
38 .P
39 The function
40 .BR __fpurge ()
41 does precisely the same, but without returning a value.
42 .SH RETURN VALUE
43 Upon successful completion
44 .BR fpurge ()
45 returns 0.
46 On error, it returns \-1 and sets
47 .I errno
48 to indicate the error.
49 .SH ERRORS
50 .TP
51 .B EBADF
52 .I stream
53 is not an open stream.
54 .SH ATTRIBUTES
55 For an explanation of the terms used in this section, see
56 .BR attributes (7).
57 .TS
58 allbox;
59 lbx lb lb
60 l l l.
61 Interface Attribute Value
62 T{
63 .na
64 .nh
65 .BR __fpurge ()
66 T} Thread safety MT-Safe race:stream
67 .TE
68 .SH STANDARDS
69 None.
70 .SH HISTORY
71 .TP
72 .BR fpurge ()
73 4.4BSD.
74 Not available under Linux.
75 .TP
76 .BR __fpurge ()
77 Solaris, glibc 2.1.95.
78 .SH NOTES
79 Usually it is a mistake to want to discard input buffers.
80 .SH SEE ALSO
81 .\" .BR fclean (3),
82 .BR fflush (3),
83 .BR setbuf (3),
84 .BR stdio_ext (3)