]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man3/fpurge.3
man*/: ffix (un-bracket tables)
[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 .TS
57 allbox;
58 lbx lb lb
59 l l l.
60 Interface Attribute Value
61 T{
62 .na
63 .nh
64 .BR __fpurge ()
65 T} Thread safety MT-Safe race:stream
66 .TE
67 .sp 1
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)