OSDN Git Service

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