WCSWIDTH(3P)
π WCSWIDTH(3P) π
okay bestie, welcome to the POSIX Programmer's Manual β yes, the one and only. this page is WCSWIDTH(3P), and before we get into it, the legal girlies have notes:
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 of Linux behavior), or the interface may not be implemented on Linux.
so like. it might be different on Linux. it might not exist on Linux at all. read the Linux page, she's telling you upfront. π«Ά
β¨ NAME β¨
wcswidth β number of column positions of a wide-character string
she counts how much space your fancy wide characters take up on the screen, no cap.
πΈ SYNOPSIS πΈ
#include <wchar.h>
int wcswidth(const wchar_t *pwcs, size_t n);
there she is. two args, int coming back at you. π
π¦ DESCRIPTION π¦
so here's the tea: the wcswidth() function shall determine the number of column positions required for n wide-character codes β or, plot twist, fewer than n wide-character codes if a null wide-character code shows up before you've burned through all n of them β in the string pointed to by pwcs.
basically: "how many columns of my terminal is this string gonna eat" and it stops counting early if it hits a null wide char. main character behavior honestly. β¨
π RETURN VALUE π
the wcswidth() function either shall return:
0β ifpwcspoints to a null wide-character code. (empty vibes, zero columns, we love a clean slate π)- the number of column positions to be occupied by the wide-character string pointed to by
pwcsβ the normal slay case. -1β if any of the firstnwide-character codes in the wide-character string pointed to bypwcsis not a printable wide-character code. π¨ not printable = she's not gonna give you a number, she's gonna give you-1.
π ERRORS π
No errors are defined.
like literally none. nothing to report. iconic.
The following sections are informative.
π EXAMPLES π
None.
ngl bestie, they gave us nothing. zero examples. an empty plate. π½οΈπ
π§ APPLICATION USAGE π§
okay important lore drop: this function was removed from the final ISO/IEC 9899:1990/Amendment 1:1995 (E), and β heads up β the return value for a non-printable wide character is not specified. so don't go building your whole life on what happens when things get unprintable, iykyk. π
π RATIONALE π
None.
nothing. silence. the void. πβ¨
β FUTURE DIRECTIONS β
None.
no plans, no roadmap, she's just existing. periodt. π
π₯ SEE ALSO π₯
wcwidth()- The Base Definitions volume of
POSIX.1β2017, Section 3.103, Column Position,<wchar.h>
go read those next, bestie, they're the supporting cast. π«Ά
π 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, babe! brought to you by IEEE/The Open Group, 2017 β yes, the footer girlies β WCSWIDTH(3P), out. πβ¨π
π¦ 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