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(3)
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, that  is,  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

CONFORMING TO

38       C99.
39

NOTES

41       The original wcs wide-character string is destructively modified during
42       the operation.
43

EXAMPLE

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

SEE ALSO

58       strtok(3), wcschr(3)
59

COLOPHON

61       This  page  is  part of release 3.22 of the Linux man-pages project.  A
62       description of the project, and information about reporting  bugs,  can
63       be found at http://www.kernel.org/doc/man-pages/.
64
65
66
67GNU                               1999-07-25                         WCSTOK(3)
Impressum