Microsoft KB Archive/71285

= INFO: strtok Needs No Additional Space to Insert Nulls =

Article ID: 71285

Article Last Modified on 12/12/2003

-

APPLIES TO

 The C Run-Time (CRT), when used with:  Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 1.5 Professional Edition

 Microsoft Visual C++ 1.0 Professional Edition

 Microsoft Visual C++ 2.0 Professional Edition</li></ul>

 Microsoft Visual C++ 4.0 Standard Edition</li></ul>

 Microsoft Visual C++ 5.0 Standard Edition</li></ul> </li></ul>

-

<div class="notice_section">

This article was previously published under Q71285

<div class="notice_section">

<div class="summary_section">

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.

Keywords: kbcrt KB71285

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.