1 // 2 // strtok.cpp 3 // 4 // Copyright (c) Microsoft Corporation. All rights reserved. 5 // 6 // Defines strtok(), which tokenizes a string via repeated calls. 7 // 8 // strtok() considers the string to consist of a sequence of zero or more text 9 // tokens separated by spans of one or more control characters. The first call, 10 // with a string specified, returns a pointer to the first character of the 11 // first token, and will write a null character into the string immediately 12 // following the returned token. Subsequent calls with a null string argument 13 // will work through the string until no tokens remain. The control string 14 // may be different from call to call. When no tokens remain in the string, a 15 // null pointer is returned. 16 // 17 #include <corecrt_internal.h> 18 #include <string.h> 19 20 21 22 extern "C" char* __cdecl __acrt_strtok_s_novalidation( 23 _Inout_opt_z_ char* string, 24 _In_z_ char const* control, 25 _Inout_ _Deref_prepost_opt_z_ char** context 26 ); 27 28 29 30 extern "C" char* __cdecl strtok(char* const string, char const* const control) 31 { 32 return __acrt_strtok_s_novalidation(string, control, &__acrt_getptd()->_strtok_token); 33 } 34