cid 4629d334fcf669b5b1f6b6dce75d1f6167545a8a9a5f29ae2c967555015ef694 · original · open access · via man
Title: strlen(3) - Linux manual page
Authors:
Venue: man
Year: 2008
Canonical: man:man3/strlen.3
URL: https://man7.org/linux/man-pages/man3/strlen.3.html
Collector: man
OA: true
ABSTRACT
strlen(3) - Linux manual page man7.org Linux man-pages Linux/UNIX system programming training strlen(3) — Linux manual page NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUE | ATTRIBUTES | STANDARDS | HISTORY | SEE ALSO | COLOPHON strlen(3) Library Functions Manual strlen(3) NAME top strlen - string length LIBRARY top Standard C library (libc, -lc) SYNOPSIS top #include size_t strlen(const char *s); DESCRIPTION top The strlen() function calculates the length of the string pointed to by s, excluding the terminating null byte ('\0'). It is equivalent to strnul(s) - s RETURN VALUE top The strlen() function returns the number of bytes in the string pointed to by s. ATTRIBUTES top For an explanation of the terms used in this section, see attributes(7). ┌──────────────────────────────────────┬───────────────┬─────────┐ │ Interface │ Attribute │ Value │ ├──────────────────────────────────────┼───────────────┼─────────┤ │ strlen() │ Thread safety │ MT-Safe │ └──────────────────────────────────────┴───────────────┴─────────┘ STANDARDS top C11, POSIX.1-2008. HISTORY top POSIX.1-2001, C89, SVr4, 4.3BSD. SEE ALSO top string(3), strnul(3), wcslen(3) COLOPHON top This page is part of the man-pages (Linux kernel and C library user-space interface documentation) project. Information about the project can be found at ⟨https://www.kernel.org/doc/man-pages/⟩. If you have a bug report for this manual page, see ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩. This page was obtained from the tarball man-pages-6.19.tar.gz fetched from ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on 2026-09-09. If you discover any rendering problems in this HTML version of the page, or you believe there is a better or more up- to-date source for the page, or you have corrections or improvements to the information in this COLOPHON (which is not part of the original manual page), send a mail to man-pages@man7.org Linux man-pages 6.19 2026-08-10 strlen(3) Pages that refer to this page: audit_encode_nv_string(3), audit_encode_value(3), lber-types(3), pmfstring(3), rawmemchr(3), string(3), strnul(3), wcslen(3), signal-safety(7) HTML rendering created 2026-09-09 by Michael Kerrisk, author of The Linux Programming Interface. For details of in-depth Linux/UNIX system programming training courses that I teach, look here. Hosting by jambit GmbH.