]> CyberLeo.Net >> Repos - FreeBSD/releng/7.2.git/blob - lib/libc/stdio/ferror.3
Create releng/7.2 from stable/7 in preparation for 7.2-RELEASE.
[FreeBSD/releng/7.2.git] / lib / libc / stdio / ferror.3
1 .\" Copyright (c) 1990, 1991, 1993
2 .\"     The Regents of the University of California.  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 .\"
8 .\" Redistribution and use in source and binary forms, with or without
9 .\" modification, are permitted provided that the following conditions
10 .\" are met:
11 .\" 1. Redistributions of source code must retain the above copyright
12 .\"    notice, this list of conditions and the following disclaimer.
13 .\" 2. Redistributions in binary form must reproduce the above copyright
14 .\"    notice, this list of conditions and the following disclaimer in the
15 .\"    documentation and/or other materials provided with the distribution.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)ferror.3    8.2 (Berkeley) 4/19/94
33 .\" $FreeBSD$
34 .\"
35 .Dd January 10, 2003
36 .Dt FERROR 3
37 .Os
38 .Sh NAME
39 .Nm clearerr ,
40 .Nm clearerr_unlocked ,
41 .Nm feof ,
42 .Nm feof_unlocked ,
43 .Nm ferror ,
44 .Nm ferror_unlocked ,
45 .Nm fileno ,
46 .Nm fileno_unlocked
47 .Nd check and reset stream status
48 .Sh LIBRARY
49 .Lb libc
50 .Sh SYNOPSIS
51 .In stdio.h
52 .Ft void
53 .Fn clearerr "FILE *stream"
54 .Ft void
55 .Fn clearerr_unlocked "FILE *stream"
56 .Ft int
57 .Fn feof "FILE *stream"
58 .Ft int
59 .Fn feof_unlocked "FILE *stream"
60 .Ft int
61 .Fn ferror "FILE *stream"
62 .Ft int
63 .Fn ferror_unlocked "FILE *stream"
64 .Ft int
65 .Fn fileno "FILE *stream"
66 .Ft int
67 .Fn fileno_unlocked "FILE *stream"
68 .Sh DESCRIPTION
69 The function
70 .Fn clearerr
71 clears the end-of-file and error indicators for the stream pointed
72 to by
73 .Fa stream .
74 .Pp
75 The function
76 .Fn feof
77 tests the end-of-file indicator for the stream pointed to by
78 .Fa stream ,
79 returning non-zero if it is set.
80 The end-of-file indicator can only be cleared by the function
81 .Fn clearerr .
82 .Pp
83 The function
84 .Fn ferror
85 tests the error indicator for the stream pointed to by
86 .Fa stream ,
87 returning non-zero if it is set.
88 The error indicator can only be reset by the
89 .Fn clearerr
90 function.
91 .Pp
92 The function
93 .Fn fileno
94 examines the argument
95 .Fa stream
96 and returns its integer descriptor.
97 .Pp
98 The
99 .Fn clearerr_unlocked ,
100 .Fn feof_unlocked ,
101 .Fn ferror_unlocked ,
102 and
103 .Fn fileno_unlocked
104 functions are equivalent to
105 .Fn clearerr ,
106 .Fn feof ,
107 .Fn ferror ,
108 and
109 .Fn fileno
110 respectively, except that the caller is responsible for locking the stream
111 with
112 .Xr flockfile 3
113 before calling them.
114 These functions may be used to avoid the overhead of locking the stream
115 and to prevent races when multiple threads are operating on the same stream.
116 .Sh ERRORS
117 These functions should not fail and do not set the external
118 variable
119 .Va errno .
120 .Sh SEE ALSO
121 .Xr open 2 ,
122 .Xr fdopen 3 ,
123 .Xr flockfile 3 ,
124 .Xr stdio 3
125 .Sh STANDARDS
126 The functions
127 .Fn clearerr ,
128 .Fn feof ,
129 and
130 .Fn ferror
131 conform to
132 .St -isoC .