Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

wcstok - Split wide character string into tokens

&pagelevel(4)&pagelevel

Definition   

#include <wchar.h>

wchar_t *wcstok(wchar_t *ws1, const wchar_t *ws2, wchar_t **ptr);

wcstok can be used to split a wide character string ws1 into wide character substrings called “tokens”, e.g. a sentence into individual words, or a source program statement into its smallest syntactical units. The pointer to ws1 may only be passed in the first call to wcstok. The wcstok function stores the information necessary for it to continue scanning the same wide string in ptr.
In the second and all subsequent calls, a null pointer must be specified for ws1, and the value in ptr should match that stored by the previous call for the same wide string.

The start and end criterion for each token are separator characters (delimiters), which must be specified in a second wide character string ws2. Tokens may be delimited by one or more such separators or by the beginning and end of the entire wide character string ws1. Blanks, colons, commas, etc., are typical separators between the words of a sentence.

wcstok processes exactly one token per call. The first call returns a pointer to the beginning of the first wide character token found, and each subsequent call returns a pointer to the beginning of the next such token. wcstok terminates each wide character token with a null wide character code (\0).

A different delimiter string ws2 may be specified in each call.

Return val.

Pointer to the start of a wide character token.


A pointer to the first wide character token is returned at the first call; a pointer to the next wide character token at the next call, and so on.
wcstok terminates each wide character token in ws1 with a null wide character code (\0) by overwriting the first found delimiter in each case with the null wide character code (\0).

NULL pointer

if no wide character token, or no further wide character token was found.

Note

This version of the C runtime system only supports one-byte characters as wide character codes.

See also

strtok