Hi all,

This is my first post here so I don't know if it is a repost but I would appreciate any replies even if it is. I am writing a small command interpreter and after getting a line of input from the user I have to parse it to figure out which command was given. What I have now is as follows:

Code:
//Inside loop getting info from the user
char *infoa;
char *infob;

if (sscanf(line, "command option %s %s", infoa, infob) == 2){
   //Do the command
}
There are then other sscanf if statements to check the other commands. The first issue is this is giving me a bus error when i type "command option a b" (a and b can be anything). If I change the %s to %d and the type of infoa and infob to ints, it works so why is it not working with strings? Secondly, I believe there must be a better way to parse strings but I have no idea what it is. If anyone can point me in a better direction, I would definately appreciate it.

Thanks all