1FERROR(3) Linux Programmer's Manual FERROR(3)
2
3
4
6 clearerr, feof, ferror, fileno - check and reset stream status
7
9 #include <stdio.h>
10
11 void clearerr(FILE *stream);
12
13 int feof(FILE *stream);
14
15 int ferror(FILE *stream);
16
17 int fileno(FILE *stream);
18
19 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
20
21 fileno(): _POSIX_C_SOURCE
22
24 The function clearerr() clears the end-of-file and error indicators for
25 the stream pointed to by stream.
26
27 The function feof() tests the end-of-file indicator for the stream
28 pointed to by stream, returning nonzero if it is set. The end-of-file
29 indicator can be cleared only by the function clearerr().
30
31 The function ferror() tests the error indicator for the stream pointed
32 to by stream, returning nonzero if it is set. The error indicator can
33 be reset only by the clearerr() function.
34
35 The function fileno() examines the argument stream and returns the
36 integer file descriptor used to implement this stream. The file
37 descriptor is still owned by stream and will be closed when fclose(3)
38 is called. Duplicate the file descriptor with dup(2) before passing it
39 to code that might close it.
40
41 For nonlocking counterparts, see unlocked_stdio(3).
42
44 These functions should not fail and do not set the external variable
45 errno. (However, in case fileno() detects that its argument is not a
46 valid stream, it must return -1 and set errno to EBADF.)
47
49 For an explanation of the terms used in this section, see
50 attributes(7).
51
52 ┌────────────────────┬───────────────┬─────────┐
53 │Interface │ Attribute │ Value │
54 ├────────────────────┼───────────────┼─────────┤
55 │clearerr(), feof(), │ Thread safety │ MT-Safe │
56 │ferror(), fileno() │ │ │
57 └────────────────────┴───────────────┴─────────┘
59 The functions clearerr(), feof(), and ferror() conform to C89, C99,
60 POSIX.1-2001, and POSIX.1-2008.
61
62 The function fileno() conforms to POSIX.1-2001 and POSIX.1-2008.
63
65 open(2), fdopen(3), stdio(3), unlocked_stdio(3)
66
68 This page is part of release 5.04 of the Linux man-pages project. A
69 description of the project, information about reporting bugs, and the
70 latest version of this page, can be found at
71 https://www.kernel.org/doc/man-pages/.
72
73
74
75 2019-03-06 FERROR(3)