version 1 showing authors affecting page license.
.
Rev |
Author |
# |
Line |
1 |
perry |
1 |
STRTOK |
|
|
2 |
!!!STRTOK |
|
|
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
BUGS |
|
|
7 |
RETURN VALUE |
|
|
8 |
CONFORMING TO |
|
|
9 |
SEE ALSO |
|
|
10 |
---- |
|
|
11 |
!!NAME |
|
|
12 |
|
|
|
13 |
|
|
|
14 |
strtok, strtok_r - extract tokens from strings |
|
|
15 |
!!SYNOPSIS |
|
|
16 |
|
|
|
17 |
|
|
|
18 |
__#include |
|
|
19 |
__''s''__, const char *__''delim''__); |
|
|
20 |
char *strtok_r(char *__''s''__, const char *__''delim''__, char **__''ptrptr''__); |
|
|
21 |
__ |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
A `token' is a nonempty string of characters not occurring |
|
|
26 |
in the string ''delim'', followed by 0 or by a character |
|
|
27 |
occurring in ''delim''. |
|
|
28 |
|
|
|
29 |
|
|
|
30 |
The __strtok()__ function can be used to parse the string |
|
|
31 |
''s'' into tokens. The first call to __strtok()__ |
|
|
32 |
should have ''s'' as its first argument. Subsequent calls |
|
|
33 |
should have the first argument set to NULL. Each call |
|
|
34 |
returns a pointer to the next token, or NULL when no more |
|
|
35 |
tokens are found. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
If a token ends with a delimiter, this delimiting character |
|
|
39 |
is overwritten with a 0 and a pointer to the next character |
|
|
40 |
is saved for the next call to __strtok()__. The delimiter |
|
|
41 |
string ''delim'' may be different for each |
|
|
42 |
call. |
|
|
43 |
|
|
|
44 |
|
|
|
45 |
The __strtok_r()__ function works the same as the |
|
|
46 |
__strtok()__ function, but instead of using a static |
|
|
47 |
buffer it uses a pointer to a user allocated char* pointer. |
|
|
48 |
This pointer, the ''ptrptr'' parameter, must be the same |
|
|
49 |
while parsing the same string. |
|
|
50 |
!!BUGS |
|
|
51 |
|
|
|
52 |
|
|
|
53 |
Never use these functions. If you do, note |
|
|
54 |
that: |
|
|
55 |
|
|
|
56 |
|
|
|
57 |
These functions modify their first argument. |
|
|
58 |
|
|
|
59 |
|
|
|
60 |
The identity of the delimiting character is |
|
|
61 |
lost. |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
These functions cannot be used on constant |
|
|
65 |
strings. |
|
|
66 |
|
|
|
67 |
|
|
|
68 |
The __strtok__() function uses a static buffer while |
|
|
69 |
parsing, so it's not thread safe. Use __strtok_r__() if |
|
|
70 |
this matters to you. |
|
|
71 |
!!RETURN VALUE |
|
|
72 |
|
|
|
73 |
|
|
|
74 |
The __strtok()__ function returns a pointer to the next |
|
|
75 |
token, or NULL if there are no more tokens. |
|
|
76 |
!!CONFORMING TO |
|
|
77 |
|
|
|
78 |
|
|
|
79 |
strtok() |
|
|
80 |
|
|
|
81 |
|
|
|
82 |
SVID 3, POSIX, BSD 4.3, ISO 9899 |
|
|
83 |
|
|
|
84 |
|
|
|
85 |
strtok_r() |
|
|
86 |
|
|
|
87 |
|
|
|
88 |
POSIX.1c |
|
|
89 |
!!SEE ALSO |
|
|
90 |
|
|
|
91 |
|
|
|
92 |
index(3), memchr(3), rindex(3), |
|
|
93 |
strchr(3), strpbrk(3), strsep(3), |
|
|
94 |
strspn(3), strstr(3) |
|
|
95 |
---- |