1STRNLEN(3)                 Linux Programmer's Manual                STRNLEN(3)
2
3
4

NAME

6       strnlen - determine the length of a fixed-size string
7

SYNOPSIS

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               _POSIX_C_SOURCE >= 200809L
18           Before glibc 2.10:
19               _GNU_SOURCE
20

DESCRIPTION

22       The  strnlen()  function returns the number of characters 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       characters in the string pointed to by s and never beyond s+maxlen.
26

RETURN VALUE

28       The strnlen() function returns strlen(s), if that is less than  maxlen,
29       or maxlen if there is no null terminating ('\0') among the first maxlen
30       characters pointed to by s.
31

ATTRIBUTES

33       For  an  explanation  of  the  terms  used   in   this   section,   see
34       attributes(7).
35
36       ┌──────────┬───────────────┬─────────┐
37Interface Attribute     Value   
38       ├──────────┼───────────────┼─────────┤
39strnlen() │ Thread safety │ MT-Safe │
40       └──────────┴───────────────┴─────────┘

CONFORMING TO

42       POSIX.1-2008.
43

SEE ALSO

45       strlen(3)
46

COLOPHON

48       This  page  is  part of release 4.15 of the Linux man-pages project.  A
49       description of the project, information about reporting bugs,  and  the
50       latest     version     of     this    page,    can    be    found    at
51       https://www.kernel.org/doc/man-pages/.
52
53
54
55GNU                               2016-03-15                        STRNLEN(3)
Impressum