Imported upstream version 1.5
[manpages-zh.git] / src / man3 / ferror.3
blob950c9bf07e0b7ee0d5c8006de5dff8be2e3e4647
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  2001-10-16 "" "Linux Programmer's Manual"
43 .SH NAME
44 clearerr, feof, ferror, fileno \- 检测和重置流状态
45 .SH "SYNOPSIS 总览"
46 .B #include <stdio.h>
47 .sp
48 .BI "void clearerr(FILE *" stream );
49 .br
50 .BI "int feof(FILE *" stream );
51 .br
52 .BI "int ferror(FILE *" stream );
53 .br
54 .BI "int fileno(FILE *" stream );
55 .SH "DESCRIPTION 描述"
56 函数
57 .B clearerr
58 清除
59 .IR stream
60 指向的流中的文件结束标记和错误标记。
61 .PP
62 函数
63 .B feof
64 测试
65 tests the end-of-file indicator for the stream pointed to by
66 .IR stream
67 指向的流中的文件结束标记,如果已设置就返回非零值。文件结束标记只能用函数
68 .BR clearerr
69 清除。
70 .PP
71 函数
72 .B ferror
73 测试
74 .IR stream
75 指向的流中的错误标记,如果已设置就返回非零值。错误标记只能用函数
76 .B clearerr
77 重置。
78 .PP
79 函数
80 .B fileno
81 检测
82 .I stream
83 参数,返回它的整数形式的文件描述符。
84 .PP
85 关于对应的非锁定函数,请参见
86 .BR unlocked_stdio (3)
87
88 .SH "ERRORS 错误"
89 这些函数不应当失败,它们不设置外部变量
90 .IR errno
91 。(但是,如果
92 .B fileno
93 检测到它的参数不是有效的流,它必须返回 \-1,并且将
94 .I errno
95 设置为
96 .BR EBADF
97 。)
98 .SH "CONFORMING TO 标准参考"
99 函数
100 .BR clearerr ,
101 .BR feof ,
102 以及
103 .BR ferror
104 遵循 X3.159-1989 (``ANSI C'') 标准。
105 .SH "SEE ALSO 参见"
106 .BR open (2),
107 .BR unlocked_stdio (3),
108 .BR stdio (3)