getwchar(3)
β¨ getwchar β the manual page, but make it cute β¨
okay bestie, welcome to getwchar(3) from the Library Functions Manual π get comfy, grab a strawberry π, and let's talk about reading wide characters off stdin like the icon she is.
π NAME π
getwchar β read a wide character from standard input
π LIBRARY π
Standard C library (that's libc, link it with -lc) π«Ά
πΈ SYNOPSIS πΈ
#include <wchar.h>
wint_t getwchar(void);
that's it. no arguments. she takes nothing and she gives you a wide character. queen of minimalism π
β¨ DESCRIPTION β¨
so. getwchar() is literally the wide-character equivalent of the getchar(3) function β same energy, wider vibe. it reads a wide character from stdin and returns it. that's the whole job, and she does it flawlessly π
if the end of stream is reached, or if ferror(stdin) becomes true, she returns WEOF. no drama, just facts.
and if a wide-character conversion error happens? she sets errno to EILSEQ and returns WEOF. so like, if you see EILSEQ pop up, that's the conversion going "bestie i cannot work with this" π
oh and psst β if you wanted a nonlocking counterpart, go check unlocked_stdio(3) π¦
π₯ RETURN VALUE π₯
getwchar() returns the next wide-character from standard input, or WEOF. that's the whole range of outcomes. either a character or the sad little WEOF. no in-between, periodt.
π ATTRIBUTES π
for an explanation of the terms used in this section, go peek at attributes(7) β iykyk π
- Interface:
getwchar()- Attribute: Thread safety
- Value:
MT-Safe
so yes, she's MT-Safe, meaning you can call her from multiple threads and she will Not be messy about it. slay π
π STANDARDS π
C11, POSIX.1-2008.
π HISTORY π
C99, POSIX.1-2001.
she's been around. an OG. iconic behavior honestly π
π¦ NOTES π¦
the behavior of getwchar() depends on the LC_CTYPE category of the current locale. so like, locale matters, don't forget her fr fr.
and it is reasonable to expect that getwchar() will actually read a multibyte sequence from standard input and then convert it to a wide character. that's the vibe. multibyte in, wide character out π§
π SEE ALSO π
so that's getwchar(3)! tiny function, huge main character energy, reads wide chars from stdin and never makes it weird π
mwah π β this page came from Linux man-pages 6.20, dated 2026-02-08, and yeah that's the whole getwchar(3) footer, folded into a little sign-off because you deserve the full deets and also a goodbye hug π«Άβ¨
π¦ where this page comes from
- 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 6.20
- π the page's license: GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms