Synopsis:
hexstr=inttohexi(unsigned_val,num_bytes);
Arguments:
int_val - The integer value to convert to a hexadecimal string
num_bytes - Set to 1, 2 or 4 for byte, short integer or long integer value
Description: This function converts the integer value int_val argument into the corresponding hexadecimal string . The num_bytes argument defines whether the integer should be treated as a 1 byte (char), 2 byte (short) or 4 byte (long) integer and will thus be converted into a 2,4 or 8 character hexidecimal string respectively.
Each byte of the integer will be converted to exactly two hexadecimal characters in the returned string in little endian byte order (i.e byte order will be low to high). This function is useful in some of the other library functions (such as the CCsetparm() function) where a hexadecimal string is required for a parameter value.
Examples:
// This will return hex_str="ff"
hex_str=CCinttohex(255,1);
// This will return hex_str="ff00"
hex_str=CCinttohex(255,2);
// This will return hex_str="ff000000"
hex_str=CCinttohex(255,4);
// This will return hex_str="80000000"
hex_str=CCinttohex(-128,4);
Returns: Returns the hexidecimal string representation of the given integer