]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/ferror.3
dlopen.3: Note that symbol use might keep a dlclose'd object in memory
[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.\"
9ba01802 44.TH FERROR 3 2019-03-06 "" "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
c36a6bed
EH
92and returns the integer file descriptor used to implement this stream.
93The file descriptor is still owned by
94.I stream
95and will be closed when
96.BR fclose (3)
97is called.
98Duplicate the file descriptor with
99.BR dup (2)
100before passing it to code that might close it.
fea681da 101.PP
24b74457 102For nonlocking counterparts, see
fea681da
MK
103.BR unlocked_stdio (3).
104.SH ERRORS
105These functions should not fail and do not set the external variable
106.IR errno .
107(However, in case
e511ffb6 108.BR fileno ()
fea681da
MK
109detects that its argument is not a valid stream, it must
110return \-1 and set
111.I errno
112to
113.BR EBADF .)
82e25934 114.SH ATTRIBUTES
0952a69a
MK
115For an explanation of the terms used in this section, see
116.BR attributes (7).
117.TS
118allbox;
119lbw19 lb lb
120l l l.
121Interface Attribute Value
122T{
82e25934
PH
123.BR clearerr (),
124.BR feof (),
0952a69a 125.br
8ee22ae8 126.BR ferror (),
82e25934 127.BR fileno ()
0952a69a
MK
128T} Thread safety MT-Safe
129.TE
47297adb 130.SH CONFORMING TO
fea681da 131The functions
e511ffb6
MK
132.BR clearerr (),
133.BR feof (),
fea681da 134and
e511ffb6 135.BR ferror ()
28d286ed 136conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
847e0d88 137.PP
f76e404e
MK
138The function
139.BR fileno ()
140conforms to POSIX.1-2001 and POSIX.1-2008.
47297adb 141.SH SEE ALSO
fea681da 142.BR open (2),
78ba016d 143.BR fdopen (3),
fea681da
MK
144.BR stdio (3),
145.BR unlocked_stdio (3)