C Standard Libraries C++

wcslen()

Declaration

size_t wcslen(const wchar_t* kwpString);

Description

This function returns the number of characters in the wide-character string "kwpString" up to the null-terminator.

Example

#include <cwchar>

int main()
{
    wchar_t waString[] = L"XoaX.net";

    // Get the length of the string
    size_t uiLength = wcslen(waString);
    wprintf(L"The string \"%ws\" is %u characters long.\n",
        waString, uiLength);

    // Keep the window open until "Enter" is pressed
    getwchar();
    return 0;
}

Output

wcslen() Output
 

© 2007–2022 XoaX.net LLC. All rights reserved.