I'm working on a CGI program in C and I've hit a snag. when a url is returned it is usally encoded with special characters where any characters following the '%' char is encoded in hex. My problem is I'm not very mathematically inclined and would be interested to understand how to convert hexadecimal chars to decimal. for instance given the follwing str.

how would i go about converting it, I've searched the web and came across some codeCode:thisismeC%2B%2B%10I'm not quite sure how it works. I'd appreaciate some help or at leastCode:char upcase(char c) { if (c >= 'a' && c <= 'z') c -= 32; return c; } int hex2dec(char c) { if (c >= '0' && c <= '9') return (int) c - '0'; else { c = upcase(c); if (c >= 'A' && c <= 'F') return (int) (10 + c - 'A'); else return 0; } }

directions *ptr.

thanks.