SysTutorials

Linux Manual Pages › Section 3

strnlen(3)

strnlen – determine the length of a fixed-size string

Synopsis

#include <string.h>

size_t strnlen(const char *s, size_t maxlen);

Feature Test Macro Requirements for glibc (see feature_test_macros(7)): strnlen():

Since glibc 2.10:

_POSIX_C_SOURCE >= 200809L

Before glibc 2.10:

_GNU_SOURCE

Description

The strnlen() function returns the number of bytes in the string pointed to by s, excluding the terminating null byte (‘