WCSLEN(3) | Library Functions Manual | WCSLEN(3)

# NAME

`wcslen`, `wcsnlen` — find length of a wide string

# SYNOPSIS

`#include <wchar.h>`

size_t
`wcslen`(const wchar_t *s);

size_t
`wcsnlen`(const wchar_t *s, size_t maxlen);

# DESCRIPTION

The `wcslen`() function computes the length of the wide string s. The `wcsnlen`() function computes the length of the wide string s, up to maxlen wide characters. The `wcsnlen`() function will never attempt to address more than maxlen wide characters, making it suitable for use with wide character arrays that are not guaranteed to be NUL-terminated.

# RETURN VALUES

The `wcslen`() function returns the number of wide characters that precede the terminating null wide character.

The `wcsnlen`() function returns the number of wide characters that precede the terminating null wide character or maxlen, whichever is smaller.

# SEE ALSO

strlen(3), wcswidth(3)

# STANDARDS

The `wcslen`() function conforms to ISO/IEC 9899:1999 (“ISO C99”) and was first introduced in ISO/IEC 9899/AMD1:1995 (“ISO C90, Amendment 1”). The `wcsnlen`() function conforms to IEEE Std 1003.1-2008 (“POSIX.1”).

# HISTORY

The `wcslen`() function was ported from NetBSD and first appeared in OpenBSD 3.8. The `wcsnlen`() function first appeared in OpenBSD 7.6.

July 14, 2024 | Debian