Urlencode

How would I go about urlencoding a simple string. I am very new (12 hours) into my first c program and having problems with this. I have got a curl session posting to my web app but I need the post to be urlencoded.

Thanks
There is no hardcoded function...however, you could probably create one.

For C-strings:
Loop through your string array, then depending on what character you find (normal character or special), you can copy either that character or the new code into a second array.

For C++ std::string: (I would recommend this):
Use the string function .find() to find instances of the special symbol (probably loop through a map of the symbols) and replace them (or just append to a new string).

BTW: This post shouldn't be inside the Articles section (Beginners would probably be better)
Last edited on
Topic archived. No new replies allowed.