65,202
社区成员




#include <string.h>
#include <stdio.h>
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, &next_token);
// While there are tokens in "string1" or "string2"
while (token != NULL)
{
// Get next token:
if (token != NULL)
{
printf(" %s\n", token);
token = strtok_s(NULL, seps, &next_token);
}
}
printf("the rest token1:\n");
printf("%d", token);
}