I want to read a string with scanf and then devide it into two parts with strtok by using space as the delimiter.
Well, till now I'm this far
This simply doesn't work with space, but if I use e.g. comma instead of space, everything works perfectly.Code:char str[MAX_CHARS]; char *cmd; char *param; char delim = " "; scanf("%s", str); cmd = strtok(str, delim); param = strtok(NULL, delim);
I presume I have to alter the scanf call in some way, but I don't know how, and for the record if I use gets instead of scanf it works perfectly, too.
Thanks in advance.