wcsncmp(3)
π wcsncmp β no wait, let me introduce her properly
okay so bestie, meet wcsncmp: she compares two fixed-size wide-character strings. that's it. that's the job. she's the wide-char girlie of the strncmp(3) family, and she's iconic.
Library: the Standard C library, aka libc, linked with -lc. π«Ά
β¨ SYNOPSIS β¨
#include <wchar.h>
int wcsncmp(const wchar_t s1[], const wchar_t s2[], size_t n);
πΈ DESCRIPTION πΈ
So. wcsncmp() is literally the wide-character equivalent of the strncmp(3) function β same energy, just wide characters instead of the little ones. π
She compares the wide-character string pointed to by s1 against the wide-character string pointed to by s2, but bestie, she only looks at at most n wide characters from each string. that's the "fixed-size" part, that's the vibe check. π
And here's the tea: in each string, the comparison extends only up to the first occurrence of a null wide character (L'\0'), if there even is one. so if one of them ends early, that's where the comparing stops. no cap. π¦
β RETURN VALUE β
- She returns zero when the wide-character strings at
s1ands2, truncated to at most lengthn, are equal. matched energies, slay. π - She returns an integer greater than zero if at the first differing position
i(wherei < n), the corresponding wide-characters1[i]is greater thans2[i]. s1 ate. π₯ - She returns an integer less than zero if at that first differing position
i(wherei < n), the corresponding wide-characters1[i]is less thans2[i]. s1 is the one getting ate this time, ngl. π
π ATTRIBUTES π
for an explanation of the terms used in this section, see attributes(7). iykyk. π
wcsncmp()β Thread safety β MT-Safe π
π STANDARDS π
C11, POSIX.1-2008. she's certified, she's legit, periodt. β
π¦ HISTORY π¦
POSIX.1-2001, C99. she's been around, she's a main character with lore. π
π SEE ALSO π
and that's the whole page, bestie!! mwah. this was brought to you by Linux man-pages 6.20, dated 2026-02-08 β aka the source and the version and the date, all folded into this very cute sign-off. go compare some wide strings responsibly π§πβ¨
π¦ 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