void DECIMAL_TO_HEXA( int num, char *hex )
{
int aux_hex[32],i=0;
char hexa[32], resu[32];
while(num>0) {
aux_hex[i]=num%16;
num/=16;
i++;
}
resu[0]='\0';
i--;
for(i;i>=0;i--) {
if (aux_hex[i]<10) {
sprintf(hexa, "%d", aux_hex[i]);
strcat(resu, hexa);
}
else if (aux_hex[i]==10) strcat(resu, "A");
else if (aux_hex[i]==11) strcat(resu, "B");
else if (aux_hex[i]==12) strcat(resu, "C");
else if (aux_hex[i]==13) strcat(resu, "D");
else if (aux_hex[i]==14) strcat(resu, "E");
else if (aux_hex[i]==15) strcat(resu, "F");
}
strcpy(hex, resu);
}
Friday, January 23, 2009
WTF #2
This must be work of some dark evil mastermind.
Subscribe to:
Posts (Atom)