hm, i didn't know a function for this, so i wrote my own
Code:
#include <stdio.h>
#include <stdlib.h>
/* converts string of valid hex chars ('XX' : '0'-'9','A'-'F' )
to 1 byte char array with corresponding hex values
*/
void str2hex(char* s, char* d){
unsigned char c=0;
int shift=0;
do {
c+= (*s>'9')? *s-55:*s-48; // input must be uppercase !
if (++shift%2)
c<<=4;//first shift to left (upper half byte)
else
*d++=c, c=0; //then move to destination char
} while(*++s);//unil zero byte of source string is reached
*d=0; // add 0 byte to dest string
}
int main(int argc, char *argv[]) {
char input[]="414243";
char output[sizeof(input)/2+1];
str2hex(input,output);
printf("%s ",output);
system("PAUSE");
return 0;
}