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