# include & lt; String. H>
#include
Char string []=". A string \ tof,, tokens \ nand some more tokens ".
Char seps []=", \ t \ n ";
Char * token=NULL;
Char * next_token=NULL;
Int main (void)
{
Printf (" Tokens: \ n ");
//Establish string and get the first token:
Token=strtok_s (string, seps, & amp; Next_token);
//While there are tokens in "string1" or "string2"
While (token!=NULL)
{
//Get the next token:
If (token!=NULL)
{
Printf (" % s \ n ", token);
Token=strtok_s (NULL, seps, & amp; Next_token);
}
}
Printf (" the rest token1: \ n ");
Printf (" % d ", token);
}
Why is this excuse me?
CodePudding user response:
Char * strtok_s (char *, restrict the STR, rsize_t * restrict strmax,Const char * restrict delim, char * * restrict PTR); (2) ( since C11 )
CodePudding user response:
Try the strtok_r, this should be in c and c + + can be ~