
char* dectohex(char* dec)
{
char* hex;
int bin;
int check;
hex=(char*) malloc(4);
if(hex==NULL) exit(-1);
bin=atoi(dec);
if(bin==0 && dec[0]!='0') exit(-2);
check=sprintf(hex,"%X",bin);
if(check!=1) exit(-3);
return hex;
}
