I was having problems converting a char array like "7c7c7d7d7d7d7c7c7c7d7d7d7d7c7c7c7c7c7c7d7d7c7c7c7c7d7c7d7d7d7c7c2e2e2e""7c7c7d7d7d7d7c7c7c7d7d7d7d7c7c7c7c7c7c7d7d7c7c7c7c7d7c7d7d7d7c7c2e2e2e" into its actual integer value that would be able to be represented by '7C'`7C' as one hexadecimal value. So, after cruising for help iI created this, and thought it would be cool to share. This
This separates the char string into its right integers, and may be helpful to more people than just me ;)
unsigned int* char2int(char *a, int len) { int i,u; unsigned int *val = malloc(len*sizeof(unsigned long)); for(i=0,u=0;i<len;i++){ if(i%2==0){ if(a[i] <= 57) val[u] = (a[i]-50)<<4; else val[u] = (a[i]-55)<<4; } else{ if(a[i] <= 57) val[u] += (a[i]-50); else val[u] += (a[i]-55); u++; } } return val; } Hope it helps! Cheers