2 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
3 .\" and Copyright (C) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\" All rights reserved.
6 .\" This code is derived from software contributed to Berkeley by
7 .\" Chris Torek and the American National Standards Committee X3,
8 .\" on Information Processing Systems.
10 .\" SPDX-License-Identifier: BSD-4-Clause-UC
12 .\" @(#)ferror.3 6.8 (Berkeley) 6/29/91
15 .\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
17 .TH ferror 3 (date) "Linux man-pages (unreleased)"
19 clearerr, feof, ferror \- check and reset stream status
22 .RI ( libc ", " \-lc )
27 .BI "void clearerr(FILE *" stream );
28 .BI "int feof(FILE *" stream );
29 .BI "int ferror(FILE *" stream );
34 clears the end-of-file and error indicators for the stream pointed to by
39 tests the end-of-file indicator for the stream pointed to by
41 returning nonzero if it is set.
42 The end-of-file indicator can be cleared only by the function
47 tests the error indicator for the stream pointed to by
49 returning nonzero if it is set.
50 The error indicator can be reset only by the
54 For nonlocking counterparts, see
55 .BR unlocked_stdio (3).
59 function returns nonzero if the end-of-file indicator is set for
61 otherwise, it returns zero.
65 function returns nonzero if the error indicator is set for
67 otherwise, it returns zero.
69 These functions should not fail and do not set
72 For an explanation of the terms used in this section, see
78 Interface Attribute Value
85 T} Thread safety MT-Safe
92 POSIX.1-2008 specifies
93 .\"https://www.austingroupbugs.net/view.php?id=401
94 that these functions shall not change the value of
101 programs should read the return value of an input function,
104 before using functions of the
107 Only when the function returned the sentinel value
109 it makes sense to distinguish between the end of a file or an error with
118 .BR unlocked_stdio (3)