1STRNLEN(3) Linux Programmer's Manual STRNLEN(3)
2
3
4
6 strnlen - determine the length of a fixed-size string
7
9 #include <string.h>
10
11 size_t strnlen(const char *s, size_t maxlen);
12
13 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15 strnlen():
16 Since glibc 2.10:
17 _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L
18 Before glibc 2.10:
19 _GNU_SOURCE
20
22 The strnlen() function returns the number of bytes in the string
23 pointed to by s, excluding the terminating null byte ('\0'), but at
24 most maxlen. In doing this, strnlen() looks only at the first maxlen
25 bytes at s and never beyond s+maxlen.
26
28 The strnlen() function returns strlen(s), if that is less than maxlen,
29 or maxlen if there is no null byte ('\0') among the first maxlen bytes
30 pointed to by s.
31
33 POSIX.1-2008.
34
36 strlen(3)
37
39 This page is part of release 3.53 of the Linux man-pages project. A
40 description of the project, and information about reporting bugs, can
41 be found at http://www.kernel.org/doc/man-pages/.
42
43
44
45GNU 2012-05-10 STRNLEN(3)