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 returns WEOF. that's it. nothing else happens. bye.
  • If wc is an invalid wide character, it sets errno to EILSEQ and returns WEOF. 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