#include <string.h>
#include <stdio.h>
char string[] = "A string/tof ,,tokens/nand some more tokens";
char seps[] = " ,/t/n";
char *token;
int main( void )
{
printf( "Tokens:/n" );
// Establish string and get the first token:
token = strtok( string, seps ); // C4996
// Note: strtok is deprecated; consider using strtok_s instead
while( token != NULL )
{
// While there are tokens in "string"
printf( " %s/n", token );
// Get next token:
token = strtok( NULL, seps ); // C4996
}
}
Tokens: A string of tokens and some more tokens