I am loading some integers and long integers into a string as hexidecimal. For example:

int I 1234;

str char[2];

Then funct(I) returns:

str[0]=0x04 and str[1]=0xD2

I have written the expectable verbose routine that loops through dividing by powers of 16, generates the hex digits and stores them one by one into the string. However can someone point me to some "nice" compact way to do this?

Thanks,

Fritz