Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
strtok, _fstrtok
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The strtok function reads <string1> as a series of zero or more
tokens and <string2> as the set of characters serving as
delimiters of the tokens in <string1>. The tokens in <string1> may
be separated by one or more of the delimiters from <string2>.
The tokens are broken out of <string1> by a series of calls to
strtok. In the first call to strtok for <string1>, strtok searches
for the first token in <string1>, skipping leading delimiters. A
pointer to the first token is returned.
To read the next token from <string1>, call strtok with a NULL
value for the <string1> argument. The NULL <string1> argument
causes strtok to search for the next token in the previous token
string. The set of delimiters may vary from call to call, so
<string2> can take any value.
Note that calls to strtok modify <string1>, since strtok inserts a
null character (\0) after the token in <string1> each time it is
called.
The _fstrtok function is a model-independent (large-model) form
that uses far pointer forms of the string arguments and return
values. This model-independent function can be called from any
point in the program.
Return Value
The first time strtok is called, it returns a pointer to the first
token in <string1>. In later calls with the same token string,
strtok returns a pointer to the next token in the string. A NULL
pointer is returned when there are no more tokens. All tokens are
null terminated.
-♦-