205 lines
4.2 KiB
HTML
205 lines
4.2 KiB
HTML
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|
<HTML><HEAD><TITLE>Man page of FERROR</TITLE>
|
|
</HEAD><BODY>
|
|
<H1>FERROR</H1>
|
|
Section: Linux Programmer's Manual (3)<BR>Updated: 2019-03-06<BR><A HREF="#index">Index</A>
|
|
<A HREF="/cgi-bin/man/man2html">Return to Main Contents</A><HR>
|
|
|
|
<A NAME="lbAB"> </A>
|
|
<H2>NAME</H2>
|
|
|
|
clearerr, feof, ferror, fileno - check and reset stream status
|
|
<A NAME="lbAC"> </A>
|
|
<H2>SYNOPSIS</H2>
|
|
|
|
<B>#include <<A HREF="file:///usr/include/stdio.h">stdio.h</A>></B>
|
|
|
|
<P>
|
|
|
|
<B>void clearerr(FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<B>int feof(FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<B>int ferror(FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
<B>int fileno(FILE *</B><I>stream</I><B>);</B>
|
|
|
|
<P>
|
|
|
|
|
|
Feature Test Macro Requirements for glibc (see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+feature_test_macros">feature_test_macros</A></B>(7)):
|
|
|
|
|
|
<P>
|
|
|
|
<B>fileno</B>():
|
|
|
|
_POSIX_C_SOURCE
|
|
<A NAME="lbAD"> </A>
|
|
<H2>DESCRIPTION</H2>
|
|
|
|
The function
|
|
<B>clearerr</B>()
|
|
|
|
clears the end-of-file and error indicators for the stream pointed to by
|
|
<I>stream</I>.
|
|
|
|
<P>
|
|
|
|
The function
|
|
<B>feof</B>()
|
|
|
|
tests the end-of-file indicator for the stream pointed to by
|
|
<I>stream</I>,
|
|
|
|
returning nonzero if it is set.
|
|
The end-of-file indicator can be cleared only by the function
|
|
<B>clearerr</B>().
|
|
|
|
<P>
|
|
|
|
The function
|
|
<B>ferror</B>()
|
|
|
|
tests the error indicator for the stream pointed to by
|
|
<I>stream</I>,
|
|
|
|
returning nonzero if it is set.
|
|
The error indicator can be reset only by the
|
|
<B>clearerr</B>()
|
|
|
|
function.
|
|
<P>
|
|
|
|
The function
|
|
<B>fileno</B>()
|
|
|
|
examines the argument
|
|
<I>stream</I>
|
|
|
|
and returns the integer file descriptor used to implement this stream.
|
|
The file descriptor is still owned by
|
|
<I>stream</I>
|
|
|
|
and will be closed when
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fclose">fclose</A></B>(3)
|
|
|
|
is called.
|
|
Duplicate the file descriptor with
|
|
<B><A HREF="/cgi-bin/man/man2html?2+dup">dup</A></B>(2)
|
|
|
|
before passing it to code that might close it.
|
|
<P>
|
|
|
|
For nonlocking counterparts, see
|
|
<B><A HREF="/cgi-bin/man/man2html?3+unlocked_stdio">unlocked_stdio</A></B>(3).
|
|
|
|
<A NAME="lbAE"> </A>
|
|
<H2>ERRORS</H2>
|
|
|
|
These functions should not fail and do not set the external variable
|
|
<I>errno</I>.
|
|
|
|
(However, in case
|
|
<B>fileno</B>()
|
|
|
|
detects that its argument is not a valid stream, it must
|
|
return -1 and set
|
|
<I>errno</I>
|
|
|
|
to
|
|
<B>EBADF</B>.)
|
|
|
|
<A NAME="lbAF"> </A>
|
|
<H2>ATTRIBUTES</H2>
|
|
|
|
For an explanation of the terms used in this section, see
|
|
<B><A HREF="/cgi-bin/man/man2html?7+attributes">attributes</A></B>(7).
|
|
|
|
<TABLE BORDER>
|
|
<TR VALIGN=top><TD><B>Interface</B></TD><TD><B>Attribute</B></TD><TD><B>Value</B><BR></TD></TR>
|
|
<TR VALIGN=top><TD>
|
|
<B>clearerr</B>(),
|
|
|
|
<B>feof</B>(),
|
|
|
|
<BR>
|
|
|
|
<B>ferror</B>(),
|
|
|
|
<B>fileno</B>()
|
|
|
|
</TD><TD>Thread safety</TD><TD>MT-Safe<BR></TD></TR>
|
|
</TABLE>
|
|
|
|
<A NAME="lbAG"> </A>
|
|
<H2>CONFORMING TO</H2>
|
|
|
|
The functions
|
|
<B>clearerr</B>(),
|
|
|
|
<B>feof</B>(),
|
|
|
|
and
|
|
<B>ferror</B>()
|
|
|
|
conform to C89, C99, POSIX.1-2001, and POSIX.1-2008.
|
|
<P>
|
|
|
|
The function
|
|
<B>fileno</B>()
|
|
|
|
conforms to POSIX.1-2001 and POSIX.1-2008.
|
|
<A NAME="lbAH"> </A>
|
|
<H2>SEE ALSO</H2>
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?2+open">open</A></B>(2),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+fdopen">fdopen</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+stdio">stdio</A></B>(3),
|
|
|
|
<B><A HREF="/cgi-bin/man/man2html?3+unlocked_stdio">unlocked_stdio</A></B>(3)
|
|
|
|
<A NAME="lbAI"> </A>
|
|
<H2>COLOPHON</H2>
|
|
|
|
This page is part of release 5.05 of the Linux
|
|
<I>man-pages</I>
|
|
|
|
project.
|
|
A description of the project,
|
|
information about reporting bugs,
|
|
and the latest version of this page,
|
|
can be found at
|
|
<A HREF="https://www.kernel.org/doc/man-pages/.">https://www.kernel.org/doc/man-pages/.</A>
|
|
<P>
|
|
|
|
<HR>
|
|
<A NAME="index"> </A><H2>Index</H2>
|
|
<DL>
|
|
<DT id="1"><A HREF="#lbAB">NAME</A><DD>
|
|
<DT id="2"><A HREF="#lbAC">SYNOPSIS</A><DD>
|
|
<DT id="3"><A HREF="#lbAD">DESCRIPTION</A><DD>
|
|
<DT id="4"><A HREF="#lbAE">ERRORS</A><DD>
|
|
<DT id="5"><A HREF="#lbAF">ATTRIBUTES</A><DD>
|
|
<DT id="6"><A HREF="#lbAG">CONFORMING TO</A><DD>
|
|
<DT id="7"><A HREF="#lbAH">SEE ALSO</A><DD>
|
|
<DT id="8"><A HREF="#lbAI">COLOPHON</A><DD>
|
|
</DL>
|
|
<HR>
|
|
This document was created by
|
|
<A HREF="/cgi-bin/man/man2html">man2html</A>,
|
|
using the manual pages.<BR>
|
|
Time: 00:05:42 GMT, March 31, 2021
|
|
</BODY>
|
|
</HTML>
|