]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ferror.3
crypt.3: srcfix: rewrap source lines
[thirdparty/man-pages.git] / man3 / ferror.3
CommitLineData
fea681da
MK
1.\" Copyright (c) 1990, 1991 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
a9cd9cb7 8.\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
fea681da
MK
9.\" Redistribution and use in source and binary forms, with or without
10.\" modification, are permitted provided that the following conditions
11.\" are met:
12.\" 1. Redistributions of source code must retain the above copyright
13.\" notice, this list of conditions and the following disclaimer.
14.\" 2. Redistributions in binary form must reproduce the above copyright
15.\" notice, this list of conditions and the following disclaimer in the
16.\" documentation and/or other materials provided with the distribution.
17.\" 3. All advertising materials mentioning features or use of this software
18.\" must display the following acknowledgement:
19.\" This product includes software developed by the University of
20.\" California, Berkeley and its contributors.
21.\" 4. Neither the name of the University nor the names of its contributors
22.\" may be used to endorse or promote products derived from this software
23.\" without specific prior written permission.
24.\"
25.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35.\" SUCH DAMAGE.
8c9302dc 36.\" %%%LICENSE_END
fea681da
MK
37.\"
38.\" @(#)ferror.3 6.8 (Berkeley) 6/29/91
39.\"
40.\"
41.\" Converted for Linux, Mon Nov 29 14:24:40 1993, faith@cs.unc.edu
42.\" Added remark on EBADF for fileno, aeb, 2001-03-22
43.\"
4b8c67d9 44.TH FERROR 3 2017-09-15 "" "Linux Programmer's Manual"
fea681da
MK
45.SH NAME
46clearerr, feof, ferror, fileno \- check and reset stream status
47.SH SYNOPSIS
48.B #include <stdio.h>
68e4db0a 49.PP
fea681da 50.BI "void clearerr(FILE *" stream );
dbfe9c70 51.PP
fea681da 52.BI "int feof(FILE *" stream );
dbfe9c70 53.PP
fea681da 54.BI "int ferror(FILE *" stream );
dbfe9c70 55.PP
fea681da 56.BI "int fileno(FILE *" stream );
68e4db0a 57.PP
cc4615cc
MK
58.in -4n
59Feature Test Macro Requirements for glibc (see
60.BR feature_test_macros (7)):
61.in
68e4db0a 62.PP
cc4615cc 63.BR fileno ():
cff459de 64_POSIX_C_SOURCE
fea681da
MK
65.SH DESCRIPTION
66The function
e511ffb6 67.BR clearerr ()
fea681da
MK
68clears the end-of-file and error indicators for the stream pointed to by
69.IR stream .
70.PP
71The function
e511ffb6 72.BR feof ()
fea681da
MK
73tests the end-of-file indicator for the stream pointed to by
74.IR stream ,
c7094399 75returning nonzero if it is set.
33a0ccb2 76The end-of-file indicator can be cleared only by the function
e511ffb6 77.BR clearerr ().
fea681da
MK
78.PP
79The function
e511ffb6 80.BR ferror ()
fea681da
MK
81tests the error indicator for the stream pointed to by
82.IR stream ,
c7094399 83returning nonzero if it is set.
33a0ccb2 84The error indicator can be reset only by the
e511ffb6 85.BR clearerr ()
fea681da
MK
86function.
87.PP
88The function
e511ffb6 89.BR fileno ()
fea681da
MK
90examines the argument
91.I stream
d9cb0d7d 92and returns its integer file descriptor.
fea681da 93.PP
24b74457 94For nonlocking counterparts, see
fea681da
MK
95.BR unlocked_stdio (3).
96.SH ERRORS
97These functions should not fail and do not set the external variable
98.IR errno .
99(However, in case
e511ffb6 100.BR fileno ()
fea681da
MK
101detects that its argument is not a valid stream, it must
102return \-1 and set
103.I errno
104to
105.BR EBADF .)
82e25934 106.SH ATTRIBUTES
0952a69a
MK
107For an explanation of the terms used in this section, see
108.BR attributes (7).
109.TS
110allbox;
111lbw19 lb lb
112l l l.
113Interface Attribute Value
114T{
82e25934
PH
115.BR clearerr (),
116.BR feof (),
0952a69a 117.br
8ee22ae8 118.BR ferror (),
82e25934 119.BR fileno ()
0952a69a
MK
120T} Thread safety MT-Safe
121.TE
47297adb 122.SH CONFORMING TO
fea681da 123The functions
e511ffb6
MK
124.BR clearerr (),
125.BR feof (),
fea681da 126and
e511ffb6 127.BR ferror ()
28d286ed 128conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
847e0d88 129.PP
f76e404e
MK
130The function
131.BR fileno ()
132conforms to POSIX.1-2001 and POSIX.1-2008.
47297adb 133.SH SEE ALSO
fea681da 134.BR open (2),
78ba016d 135.BR fdopen (3),
fea681da
MK
136.BR stdio (3),
137.BR unlocked_stdio (3)