WCSWIDTH(3POSIX)
π WCSWIDTH(3POSIX) π
okay bestie so this one is part of the POSIX Programmer's Manual β you know, the group chat where all the Unix standards hang out. β¨
heads up tho: the Linux version of this interface might lowkey be different from what's written here (so go check the Linux man page for the deets on Linux behavior), or honestly it might not even be implemented on Linux at all. π vibe check your platform first, fr fr.
πΈ PROLOG πΈ
This manual page is part of the POSIX Programmer's Manual. The Linux implementation of this interface may differ β consult the corresponding Linux manual page for details on Linux behavior β or the interface may not be implemented on Linux. π
β¨ NAME β¨
wcswidth β number of column positions of a wide-character string π
π¦ SYNOPSIS π¦
#include <wchar.h>
int wcswidth(const wchar_t *pwcs, size_t n);
π DESCRIPTION π
So like, wcswidth() figures out how many column positions you need for n wide-character codes in the string that pwcs is pointing at. π
And if a null wide-character code shows up before you've burned through all n wide-character codes? Then it just does fewer than n. Not me being flexible, it's literally in the spec. π«Ά
π₯ RETURN VALUE π₯
wcswidth() does one of these three iconic things:
- returns
0β ifpwcspoints to a null wide-character code π - returns the number of column positions that the wide-character string pointed to by
pwcswill occupy β - returns
-1β if any of the firstnwide-character codes in the wide-character string pointed to bypwcsis not a printable wide-character code π
periodt.
π ERRORS π
No errors are defined. slay, no drama.
The following sections are informative. (iykyk β that means they're the bonus content, not the rules.)
π EXAMPLES π
None. π literally nothing. the example section said "no thoughts, head empty."
π APPLICATION USAGE π
Okay so important lore: this function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E). gone. and also β the return value for a non-printable wide character is not specified. so like, don't go trusting it for that case, bestie. π
π§ RATIONALE π§
None.
π FUTURE DIRECTIONS π
None.
π« SEE ALSO π«
wcwidth()- The Base Definitions volume of POSIX.1β2017, Section 3.103, Column Position,
<wchar.h>
π COPYRIGHT π
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 .
and that's the whole page, bestie!! π«Ά this one dropped in 2017, brought to you by the absolute icons at IEEE / The Open Group, and it lives under the name WCSWIDTH(3POSIX). go forth and count your columns, main character. π
β¨
π¦ where this page comes from
- debian bookworm: manpages-posix-dev 2017a-2 Β· Other
- debian trixie: manpages-posix-dev 2017a-2 Β· Other
- ubuntu jammy: manpages-posix-dev 2017a-2 Β· Other
- ubuntu noble: manpages-posix-dev 2017a-2 Β· Other
- ubuntu resolute: manpages-posix-dev 2017a-2build1 Β· Other
- ubuntu stonking: manpages-posix-dev 2017a-2.1 Β· Other
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms