im trying to make a loop that asks a command from stdin and checks if it's valid or not,
and the command for example will be in this format :
Command then seperated with any amount of spaces then a Letter then comma then a double a comma and a double
example :
command A,24.3,7.8
doesnt matter how many spaces there are so it may be :
command A, 24.3,7.8
and thought i'd use strtok but not sure how does it work...
and to use strtok to recieve a pointer which would be the end of each word,
so the first time it runs it should detect the first space and then after that the commas
how do i do that..?
as the for loop was intended to run 2 times since there will be two commas in s:
int i;
char s[100]={0};
char *comma=",";
char *cp;
printf("Enter a command:\n");
gets(s);
cp=strtok(s,comma);
for(i=0;i<2,i++)
cp=strtok(NULL,comma)