INFO: strtok(): C Function -- Documentation Supplement (51327)
The information in this article applies to:
- The C Run-Time (CRT), when used with:
- Microsoft Visual C++ for Windows, 16-bit edition 1.0
- Microsoft Visual C++ for Windows, 16-bit edition 1.5
- Microsoft Visual C++, 32-bit Editions 1.0
- Microsoft Visual C++, 32-bit Editions 2.0
- Microsoft Visual C++, 32-bit Editions 4.0
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
This article was previously published under Q51327
MS-DOS:5.1,6.0,6.00a,6.00ax,7.0; OS/2:5.1,6.0,6.00a; WINDOWS:1.0,1.5;
WINDOWS NT:1.0,2.0,4.0,5.0
SUMMARY
In Microsoft C, the strtok() function takes two strings as
arguments. The first is a series of zero or more tokens separated by
delimiters defined by the second string. The first call to strtok()
returns a pointer to the first token in the first argument. To get the
next token in the original string, a call to strtok() must be made
with NULL as the first argument, which tells strtok() to search for
the next token in the previous token string.
Keep the following information in mind when using strtok():
- strtok() will replace a delimiter in the original string with a
NULL each time the function is called using the same string, so the
original string is modified by the use of strtok().
- The second argument to strtok() can be changed at any time to a
different delimiter.
- Only single characters are considered to be delimiters.
Modification Type: | Minor | Last Reviewed: | 7/5/2005 |
---|
Keywords: | kbcode kbCRT kbinfo KB51327 |
---|
|