Debian Codegraph @

upstream/mageia-cauldron/man3/strlen.3

raw
1 '\" t
2 .\" Copyright 1993, David Metcalfe <[email protected]>
3 .\" Copyright, the authors of the Linux man-pages project
4 .\"
5 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\"
7 .TH strlen 3 2026-02-08 "Linux man-pages 6.17"
8 .SH NAME
9 strlen \- calculate the length of a string
10 .SH LIBRARY
11 Standard C library
12 .RI ( libc ,\~ \-lc )
13 .SH SYNOPSIS
14 .nf
15 .B #include <string.h>
16 .P
17 .BI "size_t strlen(const char *" s );
18 .fi
19 .SH DESCRIPTION
20 The
21 .BR strlen ()
22 function calculates the length of the string pointed to by
23 .IR s ,
24 excluding the terminating null byte (\[aq]\[rs]0\[aq]).
25 .SH RETURN VALUE
26 The
27 .BR strlen ()
28 function returns the number of bytes in the string pointed to by
29 .IR s .
30 .SH ATTRIBUTES
31 For an explanation of the terms used in this section, see
32 .BR attributes (7).
33 .TS
34 allbox;
35 lbx lb lb
36 l l l.
37 Interface Attribute Value
38 T{
39 .na
40 .nh
41 .BR strlen ()
42 T} Thread safety MT-Safe
43 .TE
44 .SH STANDARDS
45 C11, POSIX.1-2008.
46 .SH HISTORY
47 POSIX.1-2001, C89, SVr4, 4.3BSD.
48 .SH NOTES
49 In cases where the input buffer may not contain
50 a terminating null byte,
51 .BR strnlen (3)
52 should be used instead.
53 .SH SEE ALSO
54 .BR string (3),
55 .BR strnlen (3),
56 .BR wcslen (3),
57 .BR wcsnlen (3)