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

Syntax

#include <wchar.h>

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

Description

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(); subsequent calls must be specified with a null pointer.

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.

Notes

Restriction
This version of the C runtime system only supports 1-byte characters as wide character codes. They are of type wchar_t (see stddef.h). (End)

See also

wchar.h.