version 1, including all changes.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
WCSTOK |
|
|
2 |
!!!WCSTOK |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
NOTES |
|
|
8 |
EXAMPLE |
|
|
9 |
CONFORMING TO |
|
|
10 |
SEE ALSO |
|
|
11 |
---- |
|
|
12 |
!!NAME |
|
|
13 |
|
|
|
14 |
|
|
|
15 |
wcstok - split wide-character string into tokens |
|
|
16 |
!!SYNOPSIS |
|
|
17 |
|
|
|
18 |
|
|
|
19 |
__#include |
|
|
20 |
__''wcs''__, const wchar_t *__''delim''__, wchar_t **__''ptr''__); |
|
|
21 |
__ |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
The __wcstok__ function is the wide-character equivalent |
|
|
26 |
of the __strtok__ function, with an added argument to |
|
|
27 |
make it multithread-safe. It can be used to split a |
|
|
28 |
wide-character string ''wcs'' into tokens, where a token |
|
|
29 |
is defined as a substring not containing any wide-characters |
|
|
30 |
from ''delim''. |
|
|
31 |
|
|
|
32 |
|
|
|
33 |
The search starts at ''wcs'', if ''wcs'' is not NULL, |
|
|
34 |
or at ''*ptr'', if ''wcs'' is NULL. First, any |
|
|
35 |
delimiter wide-characters are skipped, i.e. the pointer is |
|
|
36 |
advanced beyond any wide-characters which occur in |
|
|
37 |
''delim''. If the end of the wide-character string is now |
|
|
38 |
reached, __wcstok__ returns NULL, to indicate that no |
|
|
39 |
tokens were found, and stores an appropriate value in |
|
|
40 |
''*ptr'', so that subsequent calls to __wcstok__ will |
|
|
41 |
continue to return NULL. Otherwise, the __wcstok__ |
|
|
42 |
function recognizes the beginning of a token and returns a |
|
|
43 |
pointer to it, but before doing that, it zero-terminates the |
|
|
44 |
token by replacing the next wide-character which occurs in |
|
|
45 |
''delim'' with a L'0' character, and it updates |
|
|
46 |
''*ptr'' so that subsequent calls will continue searching |
|
|
47 |
after the end of recognized token. |
|
|
48 |
!!RETURN VALUE |
|
|
49 |
|
|
|
50 |
|
|
|
51 |
The __wcstok__ function returns a pointer to the next |
|
|
52 |
token, or NULL if no further token was found. |
|
|
53 |
!!NOTES |
|
|
54 |
|
|
|
55 |
|
|
|
56 |
The original ''wcs'' wide-character string is |
|
|
57 |
destructively modified during the operation. |
|
|
58 |
!!EXAMPLE |
|
|
59 |
|
|
|
60 |
|
|
|
61 |
The following code loops over the tokens contained in a |
|
|
62 |
wide-character string. |
|
|
63 |
|
|
|
64 |
|
|
|
65 |
wchar_t *wcs = ...; |
|
|
66 |
wchar_t *token; |
|
|
67 |
wchar_t *state; |
|
|
68 |
for (token = wcstok(wcs, |
|
|
69 |
!!CONFORMING TO |
|
|
70 |
|
|
|
71 |
|
|
|
72 |
ISO/ANSI C, UNIX98 |
|
|
73 |
!!SEE ALSO |
|
|
74 |
|
|
|
75 |
|
|
|
76 |
strtok(3), wcschr(3) |
|
|
77 |
---- |