>You mentioned analyzing the string. Is there another way to analyze each token?
By analyzing I mean look in detail at the token. Loop through it and check for the special characters. If you find them, then double check the token to make sure that they are indeed in the context that you want them, if so you can either print them right away or save them to an array of strings and print that array in order later. Here's a very ugly implementation of that, sorry but I don't have time to come up with something more elegant. It should work though.
Code:
static void analyze ( char *a )
{
int i = 0, j = 0, k = 0;
char buf[10][40] = {'\0'};
for ( i = 0; a[i] != '\0'; i++ )
if ( a[i] == ',' || a[i] == ';' || a[i] == '(' || a[i] == ')' )
buf[++j][0] = a[i], j++;
else
buf[j][k++] = a[i];
for ( i = 0; i < 10; i++ )
if ( strlen ( buf[i] ) > 0 )
printf ( "Token: %s\n", buf[i] );
}
-Prelude