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 s1 and s2, truncated to at most length n, are equal. matched energies, slay. πŸ’…
  • She returns an integer greater than zero if at the first differing position i (where i < n), the corresponding wide-character s1[i] is greater than s2[i]. s1 ate. πŸ”₯
  • She returns an integer less than zero if at that first differing position i (where i < n), the corresponding wide-character s1[i] is less than s2[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