I am trying to accept input from a file. This file is in the format of an integer, followed by a tab, followed by a string (which may or may not have spaces).
for example:
1\tls -l
2\tls
I tried using:
int cmd_num;
char command[80];
while (fscanf(ifp, "%d\t%s", &cmd_num, command) != EOF) {
...
}
However, this failed when it saw a space. Any help?
scanfwith spaces problem, How do you allow spaces to be entered usingscanf?, and Reading string with spaces usingscanf(). The earliest of these is SO 1247989 and should probably be given precedence. I doubt this list is exhaustive.