Namespaces
Variants
Views
Actions

std::wcslen

From cppreference.com
< cpp‎ | string‎ | wide
Revision as of 19:58, 31 May 2013 by P12bot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Defined in header <cwchar>
std::size_t wcslen( const wchar_t *str );

Returns the length of a wide string, that is the number of non-null wide characters that precede the terminating null wide character.

Contents

[edit] Parameters

str - pointer to the null-terminated wide string to be examined

[edit] Return value

The length of the null-terminated wide string str.

[edit] Example

#include <iostream>
#include <cwchar>
int main()
{
    const wchar_t* str = L"Hello, world!";
    std::wcout << "The length of L\"" << str << "\" is " << std::wcslen(str) << '\n';
}

Output:

The length of L"Hello, world!" is 13

[edit] See also

C documentation for wcslen