Ok here's my code...
Now my problem is, when I'm prompted for a command & I enter "exit" and hit enter, its still waiting for me to type in the infilename. So it doesnt exit right away.
How do I get around this?
Any help is much appreciated...
Thanx!
Code:
for(;;) {
printf("Please input a command: ");
fscanf(stdin, "%s %s",cmd,infilename);
if(strcmp(cmd,"exit")==0) {
printf("--> Bye!\n");
exit(0);
}
else if(strcmp(cmd,"remove")==0) {
..................................
..code that needs the infilename..
..................................
}
else {
..more code..
}
}
Now my problem is, when I'm prompted for a command & I enter "exit" and hit enter, its still waiting for me to type in the infilename. So it doesnt exit right away.
How do I get around this?
Any help is much appreciated...
Thanx!