GETWC(3POSIX)

πŸ’– GETWC(3POSIX) β€” the POSIX Programmer's Manual glow-up πŸ’–

okay bestie, so this one lives in the POSIX Programmer's Manual, and it's literally the page for getwc. grab a boba, we're doing this πŸ§‹βœ¨

🌸 PROLOG 🌸

Real talk first, no cap: this manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β€” so if you're on Linux, go consult the corresponding Linux manual page for the deets on Linux behavior. Also possible: the interface may not be implemented on Linux at all. It's giving "check your local listings" πŸ’€


✨ NAME ✨

getwc β€” get a wide character from a stream πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

#include <stdio.h>
#include <wchar.h>

wint_t getwc(FILE *stream);

πŸ’… DESCRIPTION πŸ’…

So the functionality on this reference page is aligned with the ISO C standard. And if there's any conflict between what's written here and the ISO C standard? That conflict is unintentional, okay, it's not that deep. This volume of POSIX.1‐2017 defers to the ISO C standard. periodt πŸ‘‘

Now the actual tea: getwc() shall be equivalent to fgetwc(), except β€” and this is the plot twist β€” if it's implemented as a macro, it may evaluate stream more than once. So the argument should never be an expression with side-effects. ma'am. do not do that. 😭


🌈 RETURN VALUE 🌈

Refer to fgetwc(). that's it, that's the section 🫢


πŸ”₯ ERRORS πŸ”₯

Refer to fgetwc(). same energy, same answer πŸ’œ

The following sections are informative. (aka the chill, non-normative part of the page, keep scrolling bestie)


πŸ“ EXAMPLES πŸ“

None. zero. nothing. the void. πŸ™ˆ


⭐ APPLICATION USAGE ⭐

okay so here's the warning label: since getwc() may be implemented as a macro, it may treat a stream argument with side-effects incorrectly. Specifically β€” and I need you to hear this β€” getwc(*f++) does not necessarily work as expected. 😱

Therefore, use of this function is not recommended. Use fgetwc() instead. that's the whole vibe check. πŸ’…

bestie please just use fgetwc(). I'm begging. πŸ₯Ί

🧚 RATIONALE 🧚

None. 🌸


πŸ‘‘ FUTURE DIRECTIONS πŸ‘‘

None. πŸ’–


πŸ¦‹ SEE ALSO πŸ¦‹

  • Section 2.5, Standard I/O Streams, fgetwc()
  • The Base Definitions volume of POSIX.1‐2017, <stdio.h>, <wchar.h>

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 .


and that's the whole page, bestie!! πŸŽ€ this icon was brought to you by IEEE/The Open Group, 2017, GETWC(3POSIX) β€” mwah, go forth and fgetwc() responsibly πŸ’–βœ¨πŸ¦‹