wcswidth(3)
๐ NAME ๐
wcswidth โ bestie, this is the one that tells u how many columns a fixed-size wide-character string is gonna take up โจ
๐ธ LIBRARY ๐ธ
Standard C library (libc, -lc) ๐ซถ
โจ SYNOPSIS โจ
#define _XOPEN_SOURCE /* See feature_test_macros(7) */
#include <wchar.h>
int wcswidth(const wchar_t *s, size_t n);
๐ฆ DESCRIPTION ๐ฆ
okay so. wcswidth() looks at the wide-character string that s points to and tells u how many columns u need to represent it โ but only counting at most n wide characters. like, it's the fixed-size vibe, it stops at n and doesn't peek past it bestie ๐
and listen โ if there's a nonprintable wide character somewhere in those characters? bestie it just returns -1. that's it. that's the whole plot. ๐
๐ RETURN VALUE ๐
wcswidth() hands u back the number of column positions for the wide-character string s, truncated to at most length n. that's the whole thing, no cap ๐
๐ ATTRIBUTES ๐
for the tea on what all these terms even mean, go look at attributes(7) ๐ซถ
- Interface:
wcswidth() - Attribute: Thread safety
- Value: MT-Safe locale
โญ STANDARDS โญ
POSIX.1-2008. periodt.
๐ HISTORY ๐
POSIX.1-2001. yeah she's been around a minute, iconic behavior fr fr
๐ NOTES ๐
the way wcswidth() acts totally depends on the LC_CTYPE category of the current locale ๐ญ so like, change ur locale, change ur whole answer. iykyk ๐
๐ SEE ALSO ๐
mwah ๐ that's the whole page bestie โ from Linux man-pages 6.20, dated 2026-02-08, and it's wcswidth(3) if u ever gotta look her up again ๐ซถโจ
๐ฆ 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