FERROR(3POSIX)

🌸 FERROR(3POSIX) β€” the POSIX Programmer's Manual, bestie edition 🌸

okay so real talk before we even start: this page lives in the POSIX Programmer's Manual (that's the 3POSIX section, mwah). But heads up β€” the Linux implementation of this interface may differ from what's written here (so like, go check the corresponding Linux manual page for the actual Linux behavior if that's your situation), or honestly the interface might not even be implemented on Linux at all. πŸ™ˆ


πŸ’– PROLOG πŸ’–

This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” consult the corresponding Linux manual page for details of Linux behavior β€” or the interface may not be implemented on Linux. That's it, that's the whole prolog, no notes. ✨


πŸ‘‘ NAME πŸ‘‘

ferror β€” test error indicator on a stream. that's the vibe check. πŸ¦‹


✨ SYNOPSIS ✨

#include <stdio.h>

int ferror(FILE *stream);

like, you include <stdio.h> and then you call it. iconic behavior honestly.


πŸŽ€ DESCRIPTION πŸŽ€

So the functionality described on this reference page is aligned with the ISO C standard. And if there's any conflict between the requirements described here and the ISO C standard? That's unintentional, fr fr, no cap. This volume of POSIX.1‐2017 defers to the ISO C standard. periodt. πŸ’…

The ferror() function shall test the error indicator for the stream pointed to by stream. that's literally its whole job and it does it flawlessly.

And here's the lil detail everyone sleeps on: the ferror() function shall not change the setting of errno if stream is valid. like, it's polite. it minds its own business. 🫢


🌈 RETURN VALUE 🌈

The ferror() function shall return non-zero if and only if the error indicator is set for stream. so if the error indicator is set β†’ non-zero. if it's not set β†’ you get zero. no in-between, no chaos, just truth. ⭐


πŸ’€ ERRORS πŸ’€

No errors are defined. not a single one. this function has no enemies. 😭

The following sections are informative. (translation: the next few sections are lore, not law, bestie 🧚)


πŸ“ EXAMPLES πŸ“

None. (we stay humble, we stay mysterious. πŸ™ˆ)


πŸ¦‹ APPLICATION USAGE πŸ¦‹

None. (same energy. nothing to add, it just works. ✨)


πŸ’œ RATIONALE πŸ’œ

None. (the reasoning is ✨vibes✨ and also there is none. πŸ’€)


πŸ”₯ FUTURE DIRECTIONS πŸ”₯

None. (the future is bright but this section is empty. πŸŽ€)


πŸ’… SEE ALSO πŸ’…

  • clearerr()
  • feof()
  • fopen()

The Base Definitions volume of POSIX.1‐2017, <stdio.h>.

go read those, they're the friend group. πŸ‘‘


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. 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.


okay that's the whole page, you're officially a ferror() girlie now. non-zero means the error indicator is SET, zero means it's not, and errno stays exactly where it was if your stream is valid. go forth and slay. πŸ’–

IEEE/The Open Group β€” 2017 β€” FERROR(3POSIX) 🌟 that's the source, the version and the date, mwah, bye bestie! πŸŽ€βœ¨πŸ¦‹