wchar_t *wcstok(wchar_t *s1, const wchar_t *s2);
wcstok A sequence of calls to wcstok breaks the wide string pointed to by s1 into a sequence of tokens, each of which is delimited by a wide character from the wide string pointed to by s2. The first call in the sequence has a non-null first argument; subsequent calls in the sequence have a null first argument. The separator wide string pointed to by s2 may be different from call to call.
The first call in the sequence searches the wide string pointed to by s1 for the first wide character that is not contained in the current separator wide string pointed to by s2. If no such wide character is found, then there are no tokens in the wide string pointed to by s1 and wcstok returns a null pointer. If such a wide character is found, it is the start of the first token.
wcstok then searches from there for a wide character that is contained in the current wide separator string. If no such wide character is found, the current token extends to the end of the wide string pointed to by s1, and subsequent searches for a token will return a null pointer. If such a wude character is found, it is overwritten by a wide null character, which terminates the current token. wcstok saves a pointer to the following wide character, from which the next search for a token will start.
Each subsequent call, with a null pointer as the value of the first argument, starts searching from the saved pointer and behaves as described above.
wcstok maintains static state and is therefore not reentrant and not thread safe. See wcstok_r for a thread-safe and reentrant variant.