1 .\" Copyright (c) 1990, 1991 The Regents of the University of California.
2 .\" and Copyright (C) 2021 Michael Kerrisk <mtk.manpages@gmail.com>
3 .\" All rights reserved.
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.
9 .\" SPDX-License-Identifier: BSD-4-Clause-UC
11 .\" @(#)ferror.3 6.8 (Berkeley) 6/29/91
14 .\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
16 .TH ferror 3 (date) "Linux man-pages (unreleased)"
18 clearerr, feof, ferror \- check and reset stream status
21 .RI ( libc ", " \-lc )
26 .BI "void clearerr(FILE *" stream );
27 .BI "int feof(FILE *" stream );
28 .BI "int ferror(FILE *" stream );
33 clears the end-of-file and error indicators for the stream pointed to by
38 tests the end-of-file indicator for the stream pointed to by
40 returning nonzero if it is set.
41 The end-of-file indicator can be cleared only by the function
46 tests the error indicator for the stream pointed to by
48 returning nonzero if it is set.
49 The error indicator can be reset only by the
53 For nonlocking counterparts, see
54 .BR unlocked_stdio (3).
58 function returns nonzero if the end-of-file indicator is set for
60 otherwise, it returns zero.
64 function returns nonzero if the error indicator is set for
66 otherwise, it returns zero.
68 These functions should not fail and do not set
71 For an explanation of the terms used in this section, see
79 Interface Attribute Value
84 T} Thread safety MT-Safe
95 conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
97 POSIX.1-2008 specifies
98 .\"https://www.austingroupbugs.net/view.php?id=401
99 that these functions shall not change the value of
106 programs should read the return value of an input function,
109 before using functions of the
112 Only when the function returned the sentinel value
114 it makes sense to distinguish between the end of a file or an error with
123 .BR unlocked_stdio (3)