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