fwide(3)
π fwide(3) β the vibe check for your FILE stream's orientation
okay bestie, so the header says this is fwide(3) from the Library Functions Manual, and honestly? it's giving niche but iconic. let's get into it π¦
β¨ NAME β¨
fwide β set and determine the orientation of a FILE stream
like, is your stream a wide-character girlie or a byte girlie? this function finds out (and sometimes decides for you π ).
π LIBRARY π
Standard C library (libc, -lc)
yep, she's built in. no extra drama, no extra linking. π
πΈ SYNOPSIS πΈ
#include <wchar.h>
int fwide(FILE *stream, int mode);
π§ Feature Test Macro Requirements for glibc (peep feature_test_macros(7))
fwide():
_XOPEN_SOURCE >= 500 || _ISOC99_SOURCE
|| _POSIX_C_SOURCE >= 200112L
translation: you gotta define one of these bad boys or she simply will not appear. gatekeeping? a little. necessary? apparently. π
π DESCRIPTION π
okay so here's the tea β
When mode is zero, fwide() just determines the current orientation of stream. it's not changing anything, it's just looking. respectfully. π
- returns a positive value if
streamis wide-character oriented β meaning wide-character I/O is permitted butcharI/O is disallowed. so it picked a side and committed. periodt. - returns a negative value if
streamis byte oriented β meaningcharI/O is permitted but wide-character I/O is disallowed. - returns zero if
streamhas no orientation yet π«₯ β in this case the next I/O operation might change the orientation (to byte oriented if it's acharI/O operation, or to wide-character oriented if it's a wide-character I/O operation).
no cap: once a stream has an orientation, it cannot be changed and persists until the stream is closed. it's locked in fr fr. π
When mode is nonzero, fwide() first attempts to set stream's orientation:
- to wide-character oriented if
modeis greater than 0 π₯ - to byte oriented if
modeis less than 0 π
then it returns a value denoting the current orientation, as above. so it does the thing and reports back. multitasking queen. π
π RETURN VALUE π
fwide() returns the stream's orientation, after possibly changing it.
- positive return value β wide-character oriented β¨
- negative return value β byte oriented π
- zero β undecided π
π STANDARDS π
C11, POSIX.1-2008. certified. legit. no notes.
π¦ HISTORY π¦
POSIX.1-2001, C99. she's been around, she's seen things, she's still relevant. main character energy since forever.
π NOTES π
- Wide-character output to a byte oriented stream can be performed through the
fprintf(3)function with the%lcand%lsdirectives. - Char oriented output to a wide-character oriented stream can be performed through the
fwprintf(3)function with the%cand%sdirectives.
so basically, crossing the streams? possible, if you use the right format directives. iykyk π§
β SEE ALSO β
and that's the whole page bestie, we ate and left no crumbs π this came to you from Linux man-pages 6.20, dated 2026-02-08 β fwide(3), out. π
π¦ 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