OSDN Git Service

(split) LDP: Update original to LDP v3.50.
[linuxjm/LDP_man-pages.git] / original / man3 / ferror.3
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 .\"
8 .\" %%%LICENSE_START(BSD_4_CLAUSE_UCB)
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.
36 .\" %%%LICENSE_END
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 .\"
44 .TH FERROR 3  2008-08-29 "" "Linux Programmer's Manual"
45 .SH NAME
46 clearerr, feof, ferror, fileno \- check and reset stream status
47 .SH SYNOPSIS
48 .B #include <stdio.h>
49 .sp
50 .BI "void clearerr(FILE *" stream );
51
52 .BI "int feof(FILE *" stream );
53
54 .BI "int ferror(FILE *" stream );
55
56 .BI "int fileno(FILE *" stream );
57 .sp
58 .in -4n
59 Feature Test Macro Requirements for glibc (see
60 .BR feature_test_macros (7)):
61 .in
62 .sp
63 .BR fileno ():
64 _POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE
65 .SH DESCRIPTION
66 The function
67 .BR clearerr ()
68 clears the end-of-file and error indicators for the stream pointed to by
69 .IR stream .
70 .PP
71 The function
72 .BR feof ()
73 tests the end-of-file indicator for the stream pointed to by
74 .IR stream ,
75 returning nonzero if it is set.
76 The end-of-file indicator can only be
77 cleared by the function
78 .BR clearerr ().
79 .PP
80 The function
81 .BR ferror ()
82 tests the error indicator for the stream pointed to by
83 .IR stream ,
84 returning nonzero if it is set.
85 The error indicator can only be reset by the
86 .BR clearerr ()
87 function.
88 .PP
89 The function
90 .BR fileno ()
91 examines the argument
92 .I stream
93 and returns its integer descriptor.
94 .PP
95 For nonlocking counterparts, see
96 .BR unlocked_stdio (3).
97 .SH ERRORS
98 These functions should not fail and do not set the external variable
99 .IR errno .
100 (However, in case
101 .BR fileno ()
102 detects that its argument is not a valid stream, it must
103 return \-1 and set
104 .I errno
105 to
106 .BR EBADF .)
107 .SH CONFORMING TO
108 The functions
109 .BR clearerr (),
110 .BR feof (),
111 and
112 .BR ferror ()
113 conform to C89 and C99.
114 .SH SEE ALSO
115 .BR open (2),
116 .BR fdopen (3),
117 .BR stdio (3),
118 .BR unlocked_stdio (3)