1 .\" Copyright (c) Bruno Haible <haible@clisp.cons.org>
3 .\" This is free documentation; you can redistribute it and/or
4 .\" modify it under the terms of the GNU General Public License as
5 .\" published by the Free Software Foundation; either version 2 of
6 .\" the License, or (at your option) any later version.
8 .\" References consulted:
9 .\" GNU glibc-2 source code and manual
10 .\" Dinkumware C library reference http://www.dinkumware.com/
11 .\" OpenGroup's Single UNIX specification http://www.UNIX-systems.org/online.html
14 .TH WCSTOK 3 2011-09-28 "GNU" "Linux Programmer's Manual"
16 wcstok \- split wide-character string into tokens
21 .BI "wchar_t *wcstok(wchar_t *" wcs ", const wchar_t *" delim \
27 function is the wide-character equivalent of the
30 with an added argument to make it multithread-safe.
32 to split a wide-character string \fIwcs\fP into tokens, where a token is
33 defined as a substring not containing any wide-characters from \fIdelim\fP.
35 The search starts at \fIwcs\fP, if \fIwcs\fP is not NULL,
36 or at \fI*ptr\fP, if \fIwcs\fP is NULL.
37 First, any delimiter wide-characters are skipped, that is, the
38 pointer is advanced beyond any wide-characters which occur in \fIdelim\fP.
39 If the end of the wide-character string is now
42 returns NULL, to indicate that no tokens
43 were found, and stores an appropriate value in \fI*ptr\fP,
44 so that subsequent calls to
46 will continue to return NULL.
49 function recognizes the beginning of a token
50 and returns a pointer to it, but before doing that, it zero-terminates the
51 token by replacing the next wide-character which occurs in \fIdelim\fP with
52 a null wide character (L\(aq\\0\(aq),
53 and it updates \fI*ptr\fP so that subsequent calls will
54 continue searching after the end of recognized token.
58 function returns a pointer to the next token,
59 or NULL if no further token was found.
63 The original \fIwcs\fP wide-character string is destructively modified during
66 The following code loops over the tokens contained in a wide-character string.
72 for (token = wcstok(wcs, " \\t\\n", &state);
74 token = wcstok(NULL, " \\t\\n", &state)) {