]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ferror.3
All pages: Remove the 5th argument to .TH
[thirdparty/man-pages.git] / man3 / ferror.3
CommitLineData
fea681da 1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
a23bf725 2.\" and Copyright (C) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
fea681da
MK
3.\" All rights reserved.
4.\"
5.\" This code is derived from software contributed to Berkeley by
6.\" Chris Torek and the American National Standards Committee X3,
7.\" on Information Processing Systems.
8.\"
47009d5e 9.\" SPDX-License-Identifier: BSD-4-Clause-UC
fea681da
MK
10.\"
11.\" @(#)ferror.3 6.8 (Berkeley) 6/29/91
12.\"
13.\"
14.\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
fea681da 15.\"
45186a5d 16.TH FERROR 3 2021-03-22 "Linux man-pages (unreleased)"
fea681da 17.SH NAME
15267cb8 18clearerr, feof, ferror \- check and reset stream status
afa8db94
AC
19.SH LIBRARY
20Standard C library
21.RI ( libc ", " \-lc )
fea681da 22.SH SYNOPSIS
15d65653 23.nf
fea681da 24.B #include <stdio.h>
68e4db0a 25.PP
fea681da 26.BI "void clearerr(FILE *" stream );
fea681da 27.BI "int feof(FILE *" stream );
fea681da 28.BI "int ferror(FILE *" stream );
1dd0d7b4 29.fi
fea681da
MK
30.SH DESCRIPTION
31The function
e511ffb6 32.BR clearerr ()
fea681da
MK
33clears the end-of-file and error indicators for the stream pointed to by
34.IR stream .
35.PP
36The function
e511ffb6 37.BR feof ()
fea681da
MK
38tests the end-of-file indicator for the stream pointed to by
39.IR stream ,
c7094399 40returning nonzero if it is set.
33a0ccb2 41The end-of-file indicator can be cleared only by the function
e511ffb6 42.BR clearerr ().
fea681da
MK
43.PP
44The function
e511ffb6 45.BR ferror ()
fea681da
MK
46tests the error indicator for the stream pointed to by
47.IR stream ,
c7094399 48returning nonzero if it is set.
33a0ccb2 49The error indicator can be reset only by the
e511ffb6 50.BR clearerr ()
fea681da
MK
51function.
52.PP
24b74457 53For nonlocking counterparts, see
fea681da 54.BR unlocked_stdio (3).
5b921fc4
MK
55.SH RETURN VALUE
56The
57.BR feof ()
58function returns nonzero if the end-of-file indicator is set for
59.IR stream ;
60otherwise, it returns zero.
61.PP
62The
53de89a5 63.BR ferror ()
5b921fc4
MK
64function returns nonzero if the error indicator is set for
65.IR stream ;
66otherwise, it returns zero.
fea681da 67.SH ERRORS
a23bf725 68These functions should not fail and do not set
fea681da 69.IR errno .
82e25934 70.SH ATTRIBUTES
0952a69a
MK
71For an explanation of the terms used in this section, see
72.BR attributes (7).
c466875e
MK
73.ad l
74.nh
0952a69a
MK
75.TS
76allbox;
c466875e 77lbx lb lb
0952a69a
MK
78l l l.
79Interface Attribute Value
80T{
82e25934
PH
81.BR clearerr (),
82.BR feof (),
15267cb8 83.BR ferror ()
0952a69a
MK
84T} Thread safety MT-Safe
85.TE
c466875e
MK
86.hy
87.ad
88.sp 1
3113c7f3 89.SH STANDARDS
fea681da 90The functions
e511ffb6
MK
91.BR clearerr (),
92.BR feof (),
fea681da 93and
e511ffb6 94.BR ferror ()
28d286ed 95conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
a23bf725
MK
96.SH NOTES
97POSIX.1-2008 specifies
98.\"https://www.austingroupbugs.net/view.php?id=401
99that these functions shall not change the value of
100.I errno
101if
102.I stream
103is valid.
47297adb 104.SH SEE ALSO
fea681da 105.BR open (2),
78ba016d 106.BR fdopen (3),
15267cb8 107.BR fileno (3),
fea681da
MK
108.BR stdio (3),
109.BR unlocked_stdio (3)