I\'m trying to split a string into tokens but somewhat recursively. I am trying to parse:
\"content=0&website=Google\"
so that I have a
I recommend something similar to the following:
char t_str[100];
strncpy(t_str, contents, 100);
//now strtok() on t_str, original contents will be preserved
                                                                        Here is a solution that seems to work:
char *contents = "content=0&website=Google";
char arg[100] = {0};
char value[100] = {0};
sscanf(contents, "%[^&]&%s", arg, value);
printf("%s\n%s\n", arg, value);
                                                                        scanf is more primitive than you seem to think — %s will match everything up to the next whitespace. Your best solution is probably to stick with strtok but throw it only content you've strduped from the authoritative original.