strnlen - Untitled
Description: Untitled

Next: strpbrk, Previous: strncpy, Up: Strings

### 5.32 `strnlen`—character string length

Synopsis

         #include <string.h>
         size_t strnlen(const char *str, size_t n);

Description
The `strnlen` function works out the length of the string starting at `*`str by counting chararacters until it reaches a NUL character or the maximum: n number of characters have been inspected.

Returns
`strnlen` returns the character count or n.

Portability
`strnlen` is a GNU extension.

`strnlen` requires no supporting OS subroutines.