strnul(3)
β¨ strnul(3) β¨
okay bestie, welcome to strnul(3) β the lil function that finds the end of your string π
πΈ NAME πΈ
strnul β string search NUL π
π LIBRARY π
gnulib β The GNU Portability Library π«Ά
π¦ SYNOPSIS π¦
#include <string.h>
char *strnul(char *s);
const char *strnul(const char *s);
π DESCRIPTION π
so strnul() figures out where the terminating null byte ('\0') lives inside the string that s points at. that's it. that's the whole job π
it's literally equivalent to both of these expressions, no cap:
s + strlen(s)
strchr(s, '\0')
like, either one. same energy. same result. periodt β¨
π RETURN VALUE π
strnul() hands you back a pointer to that terminating null byte in the string s points to. so you get a pointer to the '\0', not the string itself. she's pointing at the finish line π
π₯ ATTRIBUTES π₯
(nvm if the terms here are confusing, attributes(7) has the whole explanation π)
- Interface:
strnul()- Attribute: Thread safety
- Value: MT-Safe β
MT-Safe means you can run her from multiple threads and she will Not cause drama π«Ά
β STANDARDS β
GNU.
π HISTORY π
gnulib 202607. β yeah she's recent, she's new on the scene, and she's already iconic π
π SEE ALSO π
ok so tl;dr: strnul() = "where's the \0? here." and honestly? we love a function with zero chaos. go forth and find your null bytes bestie π¦β¨
shoutout to the Linux man-pages 6.20 girlies, this page was dated 2026-02-25 π that's the page for strnul(3), mwah, bye π
π¦ 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: Linux-man-pages-copyleft
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms