xref: /illumos-gate/usr/src/man/man3c/ferror.3c (revision cd62a92d)
1.\"
2.\"
3.\" The contents of this file are subject to the terms of the
4.\" Common Development and Distribution License (the "License").
5.\" You may not use this file except in compliance with the License.
6.\"
7.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
8.\" or http://www.opensolaris.org/os/licensing.
9.\" See the License for the specific language governing permissions
10.\" and limitations under the License.
11.\"
12.\" When distributing Covered Code, include this CDDL HEADER in each
13.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
14.\" If applicable, add the following below this CDDL HEADER, with the
15.\" fields enclosed by brackets "[]" replaced with your own identifying
16.\" information: Portions Copyright [yyyy] [name of copyright owner]
17.\"
18.\" Copyright 1989 AT&T
19.\" Copyright (c) 2005, Sun Microsystems, Inc.  All Rights Reserved
20.\" Copyright 2020 Robert Mustacchi
21.\"
22.Dd "March 25, 2020"
23.Dt FERROR 3C
24.Os
25.Sh NAME
26.Nm ferror ,
27.Nm feof ,
28.Nm clearerr ,
29.Nm fileno
30.Nd stream status inquiries
31.Sh SYNOPSIS
32.In stdio.h
33.Ft int
34.Fo ferror
35.Fa "FILE *stream"
36.Fc
37.Ft int
38.Fo feof
39.Fa "FILE *stream"
40.Fc
41.Ft void
42.Fo clearerr
43.Fa "FILE *stream"
44.Fc
45.Ft int
46.Fo fileno
47.Fa "FILE *stream"
48.Fc
49.Sh DESCRIPTION
50The
51.Fn ferror
52function returns a non-zero value when an error has
53previously occurred reading from or writing to the named
54.Fa stream
55.Po
56see
57.Xr Intro 3
58.Pc .
59It returns
60.Sy 0
61otherwise.
62.Pp
63The
64.Fn feof
65function returns a non-zero value when
66.Sy EOF
67has previously been detected reading the named input
68.Fa stream .
69It returns
70.Sy 0
71otherwise.
72.Pp
73The
74.Fn clearerr
75function resets the error indicator and
76.Sy EOF
77indicator to 0 on the named
78.Fa stream .
79.Pp
80The
81.Fn fileno
82function returns the integer file descriptor associated with
83the named
84.Fa stream ;
85see
86.Xr open 2 .
87Streams that are not associated with a file descriptor such as those
88that were created through the
89.Xr fmemopen 3C
90or
91.Xr open_memstream 3C
92functions will return
93.Sy -1 .
94.Sh INTERFACE STABILITY
95.Sy Standard
96.Sh MT-LEVEL
97.Sy MT-Safe
98.Sh SEE ALSO
99.Xr Intro 2 ,
100.Xr open 2 ,
101.Xr fmemopen 3C ,
102.Xr fopen 3C ,
103.Xr open_memstream 3C ,
104.Xr stdio 3C
105