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