I am having difficulty scanning from user input an integer (and storing it) only if printed directly after a !
:
char cmd[MAX_LINE/2 + 1];
if (strcmp(cmd, "history") == 0)
history(hist, current);
else if (strcmp(cmd, "!!") == 0)
execMostRecHist(hist, current-1);
else if (strcmp(cmd, "!%d") == 0)
num = %d;
else
{//do stuff}
I understand this is completely wrong syntax for strcmp()
, but just as an example of how I am gathering user input.