Hi im making a shell program that reads a line of input from the user, then if "cont" is detected as the first word of the line inputted, the line will be tokenized.
here's my main code
here is my tokenize code:
char line [ MAXLINE ], * words [ MAXWORDS ], message [ MAXLINE ];
int stop =0 , nwords =0;
printf (" Enter line: " );
if ( NULL == fgets ( line , MAXLINE , stdin ))
tokenize ( line , words ,& nwords );
I'm not sure how to detect if "cont" is appeared as first word of the line, then tokenize the line.
void tokenize ( char * line , char ** words , int * nwords )
* nwords =1;
for ( words = strtok ( line , " \t\n" );
(*nwords < MAXWORDS )&&( words[*nwords ]= strtok ( NULL , " \t\n" ));
* nwords =* nwords +1);