I need help using sscanf. I have googled it and have been testing this for a few days and i just cant get it right.
I have a string, lets say:
I need to read "the cat" and "M" and put them in two separate strings.Code:char *line="term1=the cat&term2=M"
I figured at first that i could divide the string in two with:
and get "term1=the cat" on string 1 and "term2=M" on string2 and use sscanf on those in turn.Code:sscanf(line, "%[^&],%[^&]", string1, string2);
I use this sscanf line with strings with a "," instead of a "&" and no "=" and it separates the words perfectly regardless of blank spaces, but i cant get it to separate this string since the space confuses it. (and me too)
Any ideas?
thanks