Hi
I am trying to split a string with the form of "name1=value1&name2=value2" into two seperate strings. The first one would be "name1=value" and the second "name2=string2". Basically split it up at the '&" sign. I was successful in getting the first one stored but i'm unable to get it to split at the & sign. Here is a verion of my code:
Code:
char *user_name;
char strname[30], garb[30];
user_name = "username=hello&b1=submit";
sscanf(user_name, "username=%s", &strname);
printf("<P> %s", strname);
I also tried other combinations of sscanf:
sscanf(user_name, "username=%s %s", &strname, &garb);
sscanf(user_name, "username=%s &%s", &strname, &garb);
sscanf(user_name, "username=%s &b1%s", &strname, &garb);
sscanf(user_name, "username=%s" "%s", &strname, &garb);
sscanf(user_name, "username=%s %s", strname, &garb);
and none of them worked. Can anyone help me out here?