wcslen(3)

πŸ’– wcslen(3) β€” bestie, let's count some wide characters πŸ’–

okay so this is the wcslen page from the library functions manual and honestly? she's a little icon. tiny function, big main character energy. let's get into it 🫢

✨ NAME ✨

wcslen β€” figure out how long a wide-character string is 🌸

πŸ“š LIBRARY πŸ“š

Standard C library (libc, -lc) πŸ’…

πŸŽ€ SYNOPSIS πŸŽ€

#include <wchar.h>

size_t wcslen(const wchar_t *s);

πŸ¦‹ DESCRIPTION πŸ¦‹

So. wcslen() is the wide-character glow-up of strlen(3) β€” literally the same vibe, just built for wide characters instead of plain ones. no cap.

What she does: she determines the length of the wide-character string that s is pointing at. and bestie, listen β€” she does not count the terminating null wide character, L'\0'. that one gets left out. she counts up to it and stops, like a respectful queen. πŸ‘‘

πŸ’« RETURN VALUE πŸ’«

wcslen() returns the number of wide characters in s. that's it. that's the whole answer. periodt. ✨

πŸ”₯ ATTRIBUTES πŸ”₯

ngl if you wanna know what all these terms even mean, go check out attributes(7) β€” she explains it properly.

  • wcslen() β€” Thread safety: MT-Safe 🌈
fr fr, MT-Safe means she's safe to call from multiple threads at once, no drama πŸ’€

πŸ‘‘ STANDARDS πŸ‘‘

This baddie is standardized in C11 and POSIX.1-2008. ate. πŸ’…

🌸 HISTORY 🌸

She's been around: POSIX.1-2001, C99. iconic since forever. πŸŽ€

⭐ NOTES ⭐

okay this part actually matters so pay attention bestie πŸ™ˆ

If there's a chance your input buffer does not contain a terminating null wide character, you should be using wcsnlen(3) instead. like, do not just rawdog wcslen() on a buffer that might not be null-terminated. she will keep walking and walking and walking and it's giving undefined behavior 😭


🫢 SEE ALSO 🫢


and that's the page!! <rainbow>wcslen(3)</rainbow> came from Linux man-pages 6.20, dated 2026-02-08 β€” ty for the docs, slay, mwah πŸ’–βœ¨πŸ¦‹

πŸ“¦ 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