WCSTOK(3) NEWLIB WCSTOK(3)NAME
7.26 `wcstok'--get next token from a string
SYNOPSIS
#include <wchar.h>
wchar_t *wcstok(wchar_t *SOURCE, const wchar_t *DELIMITERS,
wchar_t **LASTS)
DESCRIPTION
The `wcstok' function is the wide-character equivalent of the `str‐
tok_r' function (which in turn is the same as the `strtok' function
with an added argument to make it thread-safe).
The `wcstok' function is used to isolate (one at a time) sequential
tokens in a null-terminated wide-character string, `*SOURCE'. A token
is defined as a substring not containing any wide-characters from
`*DELIMITERS'.
The first time that `wcstok' is called, `*SOURCE' should be speci‐
fied with the wide-character string to be searched, and `*LASTS'-but
not `lasts', which must be non-NULL-may be random; subsequent calls,
wishing to obtain further tokens from the same string, should pass a
null pointer for `*SOURCE' instead but must supply `*LASTS' unchanged
from the last call. The separator wide-character string, `*DELIM‐
ITERS', must be supplied each time and may change between calls. A
pointer to placeholder `*LASTS' must be supplied by the caller, and is
set each time as needed to save the state by `wcstok'. Every call to
`wcstok' with `*SOURCE' == `NULL' must pass the value of `*LASTS' as
last set by `wcstok'.
The `wcstok' function returns a pointer to the beginning of each
subsequent token in the string, after replacing the separator wide-
character itself with a null wide-character. When no more tokens
remain, a null pointer is returned.
RETURNS
`wcstok' returns a pointer to the first wide character of a token, or
`NULL' if there is no token.
PORTABILITY
`wcstok' is C99 and POSIX.1-2001.
`wcstok' requires no supporting OS subroutines.
SEE ALSOwcstok is part of the library. The full documentation for is main‐
tained as a Texinfo manual. If info and are properly installed at your
site, the command
info
will give you access to the complete manual.
NEWLIB April 2010 WCSTOK(3)