1FERROR(3) Linux Programmer's Manual FERROR(3)
2
3
4
6 clearerr, feof, ferror - check and reset stream status
7
9 #include <stdio.h>
10
11 void clearerr(FILE *stream);
12 int feof(FILE *stream);
13 int ferror(FILE *stream);
14
16 The function clearerr() clears the end-of-file and error indicators for
17 the stream pointed to by stream.
18
19 The function feof() tests the end-of-file indicator for the stream
20 pointed to by stream, returning nonzero if it is set. The end-of-file
21 indicator can be cleared only by the function clearerr().
22
23 The function ferror() tests the error indicator for the stream pointed
24 to by stream, returning nonzero if it is set. The error indicator can
25 be reset only by the clearerr() function.
26
27 For nonlocking counterparts, see unlocked_stdio(3).
28
30 The feof() function returns nonzero if the end-of-file indicator is set
31 for stream; otherwise, it returns zero.
32
33 The ferror() function returns nonzero if the error indicator is set for
34 stream; otherwise, it returns zero.
35
37 These functions should not fail and do not set errno.
38
40 For an explanation of the terms used in this section, see at‐
41 tributes(7).
42
43 ┌────────────────────────────────────────────┬───────────────┬─────────┐
44 │Interface │ Attribute │ Value │
45 ├────────────────────────────────────────────┼───────────────┼─────────┤
46 │clearerr(), feof(), ferror() │ Thread safety │ MT-Safe │
47 └────────────────────────────────────────────┴───────────────┴─────────┘
48
50 The functions clearerr(), feof(), and ferror() conform to C89, C99,
51 POSIX.1-2001, and POSIX.1-2008.
52
54 POSIX.1-2008 specifies that these functions shall not change the value
55 of errno if stream is valid.
56
58 open(2), fdopen(3), fileno(3), stdio(3), unlocked_stdio(3)
59
61 This page is part of release 5.12 of the Linux man-pages project. A
62 description of the project, information about reporting bugs, and the
63 latest version of this page, can be found at
64 https://www.kernel.org/doc/man-pages/.
65
66
67
68 2021-03-22 FERROR(3)