Standards / Extensions | C or C++ | Dependencies |
---|---|---|
ISO C Amendment |
both |
#include <wchar.h> /* or #include <wcstr.h> */
size_t wcslen(const wchar_t *string);
Computes the number of wide characters in the string pointed to by string.
The behavior of this wide-character function is affected by the LC_CTYPE category of the current locale. If you change the category, undefined results can occur.
wcslen() returns the number of wide characters that precede the terminating wide NULL character.
⁄* CELEBW12
This example computes the length of a wide-character string,
using &wcslen.
*⁄
#include <stdio.h>
#include <wchar.h>
int main(void)
{
wchar_t * string = L"abcdef";
printf( "Length of \"%ls\" is %i\n", string, wcslen( string ));
}
Length of "abcdef" is 6