Next: wcspbrk, Previous: wcpncpy, Up: Wchar strings

### 6.21 `wcsnlen`—get fixed-size wide-character string length

Synopsis

         #include <wchar.h>
         size_t wcsnlen(const wchar_t *s, size_t maxlen);

Description
The `wcsnlen` function computes the number of wide-character codes in the wide-character string pointed to by s not including the terminating L'\0' wide character but at most maxlen wide characters.

Returns
`wcsnlen` returns the length of s if it is less then maxlen, or maxlen if there is no L'\0' wide character in first maxlen characters.

Portability
`wcsnlen` is a GNU extension.

`wcsnlen` requires no supporting OS subroutines.