]>
Commit | Line | Data |
---|---|---|
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 | 18 | clearerr, feof, ferror \- check and reset stream status |
afa8db94 AC |
19 | .SH LIBRARY |
20 | Standard 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 |
31 | The function | |
e511ffb6 | 32 | .BR clearerr () |
fea681da MK |
33 | clears the end-of-file and error indicators for the stream pointed to by |
34 | .IR stream . | |
35 | .PP | |
36 | The function | |
e511ffb6 | 37 | .BR feof () |
fea681da MK |
38 | tests the end-of-file indicator for the stream pointed to by |
39 | .IR stream , | |
c7094399 | 40 | returning nonzero if it is set. |
33a0ccb2 | 41 | The end-of-file indicator can be cleared only by the function |
e511ffb6 | 42 | .BR clearerr (). |
fea681da MK |
43 | .PP |
44 | The function | |
e511ffb6 | 45 | .BR ferror () |
fea681da MK |
46 | tests the error indicator for the stream pointed to by |
47 | .IR stream , | |
c7094399 | 48 | returning nonzero if it is set. |
33a0ccb2 | 49 | The error indicator can be reset only by the |
e511ffb6 | 50 | .BR clearerr () |
fea681da MK |
51 | function. |
52 | .PP | |
24b74457 | 53 | For nonlocking counterparts, see |
fea681da | 54 | .BR unlocked_stdio (3). |
5b921fc4 MK |
55 | .SH RETURN VALUE |
56 | The | |
57 | .BR feof () | |
58 | function returns nonzero if the end-of-file indicator is set for | |
59 | .IR stream ; | |
60 | otherwise, it returns zero. | |
61 | .PP | |
62 | The | |
53de89a5 | 63 | .BR ferror () |
5b921fc4 MK |
64 | function returns nonzero if the error indicator is set for |
65 | .IR stream ; | |
66 | otherwise, it returns zero. | |
fea681da | 67 | .SH ERRORS |
a23bf725 | 68 | These functions should not fail and do not set |
fea681da | 69 | .IR errno . |
82e25934 | 70 | .SH ATTRIBUTES |
0952a69a MK |
71 | For 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 |
76 | allbox; | |
c466875e | 77 | lbx lb lb |
0952a69a MK |
78 | l l l. |
79 | Interface Attribute Value | |
80 | T{ | |
82e25934 PH |
81 | .BR clearerr (), |
82 | .BR feof (), | |
15267cb8 | 83 | .BR ferror () |
0952a69a MK |
84 | T} Thread safety MT-Safe |
85 | .TE | |
c466875e MK |
86 | .hy |
87 | .ad | |
88 | .sp 1 | |
3113c7f3 | 89 | .SH STANDARDS |
fea681da | 90 | The functions |
e511ffb6 MK |
91 | .BR clearerr (), |
92 | .BR feof (), | |
fea681da | 93 | and |
e511ffb6 | 94 | .BR ferror () |
28d286ed | 95 | conform to C89, C99, POSIX.1-2001, and POSIX.1-2008. |
a23bf725 MK |
96 | .SH NOTES |
97 | POSIX.1-2008 specifies | |
98 | .\"https://www.austingroupbugs.net/view.php?id=401 | |
99 | that these functions shall not change the value of | |
100 | .I errno | |
101 | if | |
102 | .I stream | |
103 | is 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) |