]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/ferror.3
Libc-997.1.1.tar.gz
[apple/libc.git] / stdio / FreeBSD / ferror.3
CommitLineData
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.
e9ce8d39
A
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.\"
5b2abdfb 32.\" @(#)ferror.3 8.2 (Berkeley) 4/19/94
1f2f436a 33.\" $FreeBSD: src/lib/libc/stdio/ferror.3,v 1.13 2009/01/28 14:38:41 trhodes Exp $
e9ce8d39 34.\"
1f2f436a 35.Dd January 28, 2009
5b2abdfb 36.Dt FERROR 3
e9ce8d39
A
37.Os
38.Sh NAME
5b2abdfb 39.Nm clearerr ,
9385eb3d 40.Nm clearerr_unlocked ,
5b2abdfb 41.Nm feof ,
9385eb3d 42.Nm feof_unlocked ,
5b2abdfb 43.Nm ferror ,
9385eb3d
A
44.Nm ferror_unlocked ,
45.Nm fileno ,
46.Nm fileno_unlocked
5b2abdfb 47.Nd check and reset stream status
e9ce8d39
A
48.Sh LIBRARY
49.Lb libc
50.Sh SYNOPSIS
5b2abdfb
A
51.In stdio.h
52.Ft void
53.Fn clearerr "FILE *stream"
9385eb3d
A
54.Ft void
55.Fn clearerr_unlocked "FILE *stream"
5b2abdfb
A
56.Ft int
57.Fn feof "FILE *stream"
58.Ft int
9385eb3d
A
59.Fn feof_unlocked "FILE *stream"
60.Ft int
5b2abdfb 61.Fn ferror "FILE *stream"
e9ce8d39 62.Ft int
9385eb3d
A
63.Fn ferror_unlocked "FILE *stream"
64.Ft int
5b2abdfb 65.Fn fileno "FILE *stream"
9385eb3d
A
66.Ft int
67.Fn fileno_unlocked "FILE *stream"
e9ce8d39 68.Sh DESCRIPTION
5b2abdfb
A
69The function
70.Fn clearerr
71clears the end-of-file and error indicators for the stream pointed
72to by
73.Fa stream .
74.Pp
75The function
76.Fn feof
77tests the end-of-file indicator for the stream pointed to by
78.Fa stream ,
79returning non-zero if it is set.
1f2f436a
A
80The end-of-file indicator may be cleared by explicitly calling
81.Fn clearerr ,
82or as a side-effect of other operations, e.g.\&
83.Fn fseek .
5b2abdfb
A
84.Pp
85The function
86.Fn ferror
87tests the error indicator for the stream pointed to by
88.Fa stream ,
89returning non-zero if it is set.
5b2abdfb
A
90.Pp
91The function
92.Fn fileno
93examines the argument
94.Fa stream
95and returns its integer descriptor.
9385eb3d
A
96.Pp
97The
98.Fn clearerr_unlocked ,
99.Fn feof_unlocked ,
100.Fn ferror_unlocked ,
101and
102.Fn fileno_unlocked
103functions are equivalent to
104.Fn clearerr ,
105.Fn feof ,
106.Fn ferror ,
107and
108.Fn fileno
109respectively, except that the caller is responsible for locking the stream
110with
111.Xr flockfile 3
112before calling them.
113These functions may be used to avoid the overhead of locking the stream
114and to prevent races when multiple threads are operating on the same stream.
e9ce8d39 115.Sh ERRORS
5b2abdfb
A
116These functions should not fail and do not set the external
117variable
118.Va errno .
e9ce8d39 119.Sh SEE ALSO
5b2abdfb 120.Xr open 2 ,
9385eb3d
A
121.Xr fdopen 3 ,
122.Xr flockfile 3 ,
5b2abdfb
A
123.Xr stdio 3
124.Sh STANDARDS
125The functions
126.Fn clearerr ,
127.Fn feof ,
128and
129.Fn ferror
130conform to
131.St -isoC .