BTOWC(3P)
π« BTOWC(3P) β the POSIX Programmer's Manual glow-up π«
okay bestie, so this is btowc, and it's literally living in the POSIX Programmer's Manual (3P, periodt). come sit with me, this one's a lil cutie π
πΈ PROLOG πΈ
heads up before we even start, babes: this manual page is part of the POSIX Programmer's Manual. the Linux implementation of this interface may differ (so like, go check the corresponding Linux manual page if you wanna know how Linux actually does it π), or honestly the interface may not be implemented on Linux at all. no cap. so don't come for me if your box is built different π
β¨ NAME β¨
btowc β single byte to wide character conversion π¦
like. it takes a lil one-byte bb and turns it into a wide character. that's the whole vibe. that's the job.
π SYNOPSIS π
#include <stdio.h>
#include <wchar.h>
wint_t btowc(int c);
one function, one int, and it hands you back a wint_t. iconic honestly π
π DESCRIPTION π
okay so first things first, the functionality described on this reference page is aligned with the ISO C standard. if anything here conflicts with the requirements in the ISO C standard, that conflict is unintentional β no drama intended, fr fr. this volume of POSIX.1β2017 defers to the ISO C standard. so like, ISO C is the main character here and we're just supporting cast π«Ά
now the actual tea: the btowc() function shall determine whether c constitutes a valid (one-byte) character in the initial shift state. that's it. that's the check. is this byte a real one-byte character, or is it giving nothing? π
and the behavior of this function shall be affected by the LC_CTYPE category of the current locale. so your locale is lowkey in charge of whether things count as valid. keep that in mind bestie, it matters π
π RETURN VALUE π
here's the part you actually came for:
btowc()shall returnWEOFifchas the valueEOF, or if(unsigned char) cdoes not constitute a valid (one-byte) character in the initial shift state π- otherwise, it shall return the wide-character representation of that character β¨
and in the POSIX locale specifically? btowc() shall not return WEOF if c has a value in the range 0 to 255 inclusive. so like, every single byte in that range is a valid bb in the POSIX locale. slay π
π ERRORS π
No errors are defined.
literally none. not one. it's giving peaceful. π
the following sections are informative, bestie β so like, they're here for your reading pleasure, not for the rules π
π¦ EXAMPLES π¦
None. π
πΈ APPLICATION USAGE πΈ
None. π
π§ RATIONALE π§
None. π
β FUTURE DIRECTIONS β
None. π
π₯ SEE ALSO π₯
wctob()β the reverse vibe, go check her out π―
and also: the Base Definitions volume of POSIX.1β2017, <stdio.h>, <wchar.h> π
π COPYRIGHT π
okay legal moment, stay with me, this matters:
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 .
IEEE/The Open Group dropped this in 2017, and that's the whole BTOWC(3P) moment bestie β go forth and convert those single bytes to wide characters, you absolute icon π
β¨π¦π no cap, ily, bye π«Ά
π¦ where this page comes from
- alpine 3.22: man-pages-posix 2017a-r0 Β· custom
- alpine 3.23: man-pages-posix 2017a-r0 Β· custom
- alpine 3.24: man-pages-posix 2017a-r0 Β· custom
- arch rolling: man-pages 6.19-1
- 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-posix 2017a
- opensuse-leap 16.0: man-pages-posix 2017a-160000.4.1 Β· SUSE-IEEE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms