Just something small I noticed while writing a CGI program in C: strtok() makes changes on the passed string. If you do for example this:
next = strtok(mystring,"&");
Don’t expect, that mystring has the same content as before. It will only have the same content if your string couldn’t be tokenized. But if there was another token found in this string, mystring will now have a \0 after the first occurance.
So it’s better to make a copy of the string (for example with strcpy() or strdup()) and let strtok() operate on this string instead of mystring.
Do you want to give me feedback about this article in private? Please send it to comments@zerokspot.com.
Alternatively, this website also supports Webmentions. If you write a post on a blog that supports this technique, I should get notified about your link π