1WCSTOK(3)                  Linux Programmer's Manual                 WCSTOK(3)
2
3
4

NAME

6       wcstok - split wide-character string into tokens
7

SYNOPSIS

9       #include <wchar.h>
10
11       wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **ptr);
12

DESCRIPTION

14       The  wcstok() function is the wide-character equivalent of the strtok()
15       function, with an added argument to make it multithread-safe.   It  can
16       be used to split a wide-character string wcs into tokens, where a token
17       is defined as a  substring  not  containing  any  wide-characters  from
18       delim.
19
20       The  search  starts  at  wcs, if wcs is not NULL, or at *ptr, if wcs is
21       NULL. First,  any  delimiter  wide-characters  are  skipped,  i.e.  the
22       pointer  is  advanced  beyond any wide-characters which occur in delim.
23       If the end of  the  wide-character  string  is  now  reached,  wcstok()
24       returns  NULL,  to  indicate  that  no tokens were found, and stores an
25       appropriate value in *ptr, so that subsequent calls  to  wcstok()  will
26       continue  to  return NULL.  Otherwise, the wcstok() function recognizes
27       the beginning of a token and returns a pointer to it, but before  doing
28       that, it zero-terminates the token by replacing the next wide-character
29       which occurs in delim with a L'\0' character, and it  updates  *ptr  so
30       that  subsequent  calls will continue searching after the end of recogā€
31       nized token.
32

RETURN VALUE

34       The wcstok() function returns a pointer to the next token, or  NULL  if
35       no further token was found.
36

NOTES

38       The original wcs wide-character string is destructively modified during
39       the operation.
40

EXAMPLE

42       The following code loops over the tokens contained in a  wide-character
43       string.
44
45       wchar_t *wcs = ...;
46       wchar_t *token;
47       wchar_t *state;
48       for (token = wcstok(wcs, " \t\n", &state);
49            token != NULL;
50            token = wcstok(NULL, " \t\n", &state)) {
51         ...
52       }
53

CONFORMING TO

55       C99.
56

SEE ALSO

58       strtok(3), wcschr(3)
59
60
61
62GNU                               1999-07-25                         WCSTOK(3)
Impressum