table of contents
other sections
| strchrnul(3) | Library Functions Manual | strchrnul(3) |
NAME¶
strchrnul - string search character or NUL
LIBRARY¶
Standard C library (libc, -lc)
SYNOPSIS¶
#define _GNU_SOURCE /* See feature_test_macros(7) */ #include <string.h>
char *strchrnul(const char *s, int c);
DESCRIPTION¶
The strchrnul() function is like strchr(3) except that if c is not found in s, then it returns a pointer to the null byte at the end of s.
It is equivalent to both of the following expressions:
strchr(s, c) ?: strnul(s)
s + strcspn(s, (char [2]){c, '\0'})
RETURN VALUE¶
The strchrnul() function returns a pointer to the matched character, or a pointer to the null byte at the end of s if the character is not found.
ATTRIBUTES¶
For an explanation of the terms used in this section, see attributes(7).
| Interface | Attribute | Value |
| strchrnul () | Thread safety | MT-Safe |
STANDARDS¶
GNU.
HISTORY¶
glibc 2.1.1, FreeBSD 10, NetBSD 8.
SEE ALSO¶
| 2026-02-25 | Linux man-pages 6.18 |