1strlen(3) Library Functions Manual strlen(3)
2
3
4
6 strlen - calculate the length of a string
7
9 Standard C library (libc, -lc)
10
12 #include <string.h>
13
14 size_t strlen(const char *s);
15
17 The strlen() function calculates the length of the string pointed to by
18 s, excluding the terminating null byte ('\0').
19
21 The strlen() function returns the number of bytes in the string pointed
22 to by s.
23
25 For an explanation of the terms used in this section, see at‐
26 tributes(7).
27
28 ┌────────────────────────────────────────────┬───────────────┬─────────┐
29 │Interface │ Attribute │ Value │
30 ├────────────────────────────────────────────┼───────────────┼─────────┤
31 │strlen() │ Thread safety │ MT-Safe │
32 └────────────────────────────────────────────┴───────────────┴─────────┘
33
35 C11, POSIX.1-2008.
36
38 POSIX.1-2001, C89, SVr4, 4.3BSD.
39
41 In cases where the input buffer may not contain a terminating null
42 byte, strnlen(3) should be used instead.
43
45 string(3), strnlen(3), wcslen(3), wcsnlen(3)
46
47
48
49Linux man-pages 6.04 2023-03-30 strlen(3)