std::wcstok

Header: <cwchar>

Finds the next token in a null-terminated wide string pointed to by str. The separator characters are identified by null-terminated wide string pointed to by delim.

# Declarations

wchar_t* wcstok( wchar_t* str, const wchar_t* delim, wchar_t ** ptr);

# Parameters

# Return value

Pointer to the beginning of the next token or null pointer if there are no more tokens.

# Example

#include <cwchar>
#include <iostream>
 
int main()
{
    wchar_t input[100] = L"A bird came down the walk";
    wchar_t* buffer;
    wchar_t* token = std::wcstok(input, L" ", &buffer);
    while (token)
    {
        std::wcout << token << '\n';
        token = std::wcstok(nullptr, L" ", &buffer);
    }
}

# See also