Originally Posted by
quzah
Grab the first word with sscanf and use strcmp to see if it is what you want it to be.
Quzah.
thanks for the reply. I added the sscanf :
Code:
main ()
{
char line [ MAX_LINE ] , * words [ MAX_WORDS ] , message [ MAX_LINE ];
int stop =0 , nwords =0;
int i;
while (1)
{
printf ( " Enter line:" );
if ( NULL == fgets ( line , MAX_LINE , stdin ))
return 0;
tokenize ( line , words ,& nwords );
sscanf(words, "cont", i);
}
}
I'm not sure if i did it correctly, and how do i use strcmp to compare the words so that when "cont" is appeared as first word, tokenization will then take place?