ungetwc(3)
π ungetwc(3) π
okay so bestie, this is a library functions manual page for ungetwc, and it lives in section 3 of the manual. yes we're doing wide characters today. grab a snack. π
β¨ NAME β¨
ungetwc β push back a wide character onto a FILE stream
π LIBRARY π
Standard C library (libc, -lc)
πΈ SYNOPSIS πΈ
#include <wchar.h>
wint_t ungetwc(wint_t wc, FILE *stream);
π¦ DESCRIPTION π¦
so <pink>ungetwc()</pink> is literally the wide-character equivalent of the ungetc(3) function. it takes a wide character and pushes it back onto stream, and returns it. giving "sike, I wasn't done with that character" energy. π
here's the tea, case by case:
- If wc is
WEOF, it returnsWEOF. that's it. nothing else happens. bye. - If wc is an invalid wide character, it sets
errnotoEILSEQand returnsWEOF. not slay. - If wc is a valid wide character, it gets pushed back onto the stream and thus becomes available for future wide-character read operations π. The file-position indicator is decremented by one or more. The end-of-file indicator is cleared β¨. The backing storage of the file is not affected. no cap.
Note: wc need not be the last wide-character read from the stream; it can be any other valid wide character. iconic behaviour honestly.
If the implementation supports multiple push-back operations in a row, the pushed-back wide characters will be read in reverse order; however, only one level of push-back is guaranteed. so like. one is a promise, more than one is a vibe. π
π« RETURN VALUE π«
ungetwc() returns wc when successful, or WEOF upon failure. simple as. π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7).
- Interface:
ungetwc()- Attribute: Thread safety
- Value:
MT-Safe
slay, it's thread safe, go off bestie π«Ά
π STANDARDS π
C11, POSIX.1-2008. periodt.
π HISTORY π
POSIX.1-2001, C99. it's been serving for a minute. π
π§ NOTES π§
The behavior of ungetwc() depends on the LC_CTYPE category of the current locale. so like, know your locale, iykyk. π
π SEE ALSO π
and that's the whole page, bestie π
this was page ungetwc(3), from Linux man-pages 6.20, dated 2026-02-08, and yes it says Library Functions Manual at the top like a little crown π mwah, go push back some wide characters responsibly, ily πβ¨
π¦ 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