I'm trying to ask the user for a command and argument like:
open blah
would "open" blah. Well. If the user doesn't type an argument, it goes to the next line asking for an argument. Well, this isn't good. Here is the code:
which didn't work. Here's the other code that I tried:Code:scanf("%19s 29[^\n]", cmd, arg);
which didn't work. If anyone knows how to do this, please tell me.Code:for ( j = 0; c = getchar(); j++ ) { if ( c == ' ' ){ i++; j = 0; continue; } if ( c == '\n' ) break; arg[i][j] = c; }



LinkBack URL
About LinkBacks


