INFO: strtok() Needs No Additional Space to Insert Nulls (71285)
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
This article was previously published under Q71285 SUMMARY
Sometimes it is mistakenly assumed that when the C strtok() function
inserts a null character ('\0') into the source string at the end of a
token, the length of the source string increases by this new character.
This is not the case because an additional character is not actually being
inserted. Instead, the delimiter that strtok() found to indicate the end of
the token is replaced by the null character.
Thus, when declaring or allocating the string of tokens, you do not need to
make allowances for the null characters to be inserted.
Modification Type: | Major | Last Reviewed: | 12/12/2003 |
---|
Keywords: | kbCRT KB71285 |
---|
|