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