FERROR(3P)
πΈ ferror β POSIX Programmer's Manual, section 3P πΈ
okay bestie, sit down, we're doing ferror and it's honestly so chill. this one lives in the POSIX Programmer's Manual (that's the 3P in FERROR(3P) if you were wondering, iykyk), so pull up a chair and let's vibe check your streams π
β¨ PROLOG β¨
so like, real talk first: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so pls go consult the corresponding Linux manual page for the deets on Linux behavior), or β and this is the part nobody likes β the interface might not even be implemented on Linux at all π. no cap. check before you ship.
π NAME π
ferror β test error indicator on a stream
like, it checks if your stream is having a moment.
π¦ SYNOPSIS π¦
#include <stdio.h>
int ferror(FILE *stream);
that's it. that's the whole thing. gorgeous.
π DESCRIPTION π
first up, a lil PSA: the functionality described on this reference page is aligned with the ISO C standard. any conflict between the requirements described here and the ISO C standard is unintentional β nobody's starting drama on purpose. this volume of POSIX.1β2017 defers to the ISO C standard, periodt.
ok so the actual tea β:
the ferror() function shall test the error indicator for the stream pointed to by stream. that's the whole job. it looks at the stream, it checks the error indicator, it reports back. main character behavior honestly.
and β this is the iconic part β the ferror() function shall not change the setting of errno if stream is valid. she's respectful. she doesn't touch your errno. we love a function that knows boundaries π«Ά
π₯ RETURN VALUE π₯
the ferror() function shall return non-zero if and only if the error indicator is set for stream.
so: non-zero = the error indicator is set. zero = it is not. it's giving binary, it's giving clarity, it's giving exactly what you asked for β¨
π ERRORS π
No errors are defined. literally none. iconic. flawless. she has never once had a problem.
(also: the following sections are informative β meaning they're the bonus content, not the rules π)
π EXAMPLES π
None.
ngl, the standard just said "no thoughts, head empty" on this one π
π APPLICATION USAGE π
None.
same energy. nothing to add. we're moving on bestie π§
π RATIONALE π
None.
the reasoning? she didn't feel like explaining herself and honestly? valid.
β FUTURE DIRECTIONS β
None.
the future is bright and it looks exactly like the present, no notes π
π SEE ALSO π
clearerr()β go clear that error indicator, bestiefeof()β the sibling who checks EOF insteadfopen()β where all your streams come from in the first place
and also: the Base Definitions volume of POSIX.1β2017, <stdio.h> β the header that makes all of this possible π
πΈ COPYRIGHT πΈ
ok so legally we gotta do this part, don't skip it:
portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1-2017, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, 2018 Edition, Copyright (C) 2018 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. in the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document (so like, if we beef, they win, no debate). the original Standard can be obtained online at http://www.opengroup.org/unix/online.html .
any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. to report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
and that's the whole page, bestie!! this iconic lil number came to you courtesy of IEEE/The Open Group, 2017 β so shoutout to them for FERROR(3P), we stan a standards body π
β¨π¦
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- arch rolling: man-pages 6.20-1 Β· BSD-2-Clause AND BSD-3-Clause AND BSD-4.3TAHOE AND BSD-4-Clause-UC AND GPL-1.0-or-later AND GPL-2.0-only AND GPL-2.0-or-later AND GPL-3.0-or-later AND LGPL-3.0-linking-exception AND LGPL-3.0-or-later AND LicenseRef-Public-Domain AND LicenseRef-UltraPermissive AND Linux-man-pages-1-para AND Linux-man-pages-copyleft AND Linux-man-pages-copyleft-2-para AND Linux-man-pages-copyleft-var AND MIT AND Spencer-94
- nixpkgs unstable: man-pages-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms