Brky Brky - 7 months ago 47
C Question

Convert hexadecimal value (ASCII) to text

I am trying to convert ASCII hexadecimal value (0x61 or 61) to it's

value (61 = a, etc..) without

I am saving
to temp variable, then I save first one (6) in array, then save second one (1) in array, now i want take these two and convert them to their ASCII value.

68656c6c6f0d0a = hello

void asd(char fde)
char asmg[3];
asmg[0] = "0x";
asmg[1] = "6";
asmg[2] = "1";
printf("%c", asmg);

I expected it to print "a", but it doesn't work.

Something like that, but this doesn't work. I need to put asmg[0], [1], [2] to one char, then it should work.
Thanks :)


Not sure exactly what you are trying to do but this may help.

int main(int argc, char **argv) 
    int hex[6] = {0x68, 0x65, 0x6C, 0x6C, 0x6F};
    int i = 0;

    for(i = 0; i <6; i++)
        printf("%c", hex[i]);