strange strtok behaviour
问题 char line[255]; char *token = NULL; char *line2 = NULL; char *temporaryToken = NULL; if( scanf(" %[^\n]", line) > 0) token = strtok( line, ";" ); //divide the line by ; do { line2 = token; temporaryToken = strtok(line2, " "); do { //divide the line2 by spaces into command and args, not the question here] temporaryToken = strtok( NULL, " " ); }while (temporaryToken != NULL ); token = strtok( NULL, ";" ); }while(token != NULL); this is not my code verbatim, by the way, just an example of how it