hexitoint
Previous Topic  Next Topic 

Synopsis:

       int_val=hexitoint(hexi_str,num_bytes)


Arguments:

       hexi_str - The hexadecimal string to convert

       num_bytes - The number of bytes to convert (either 1,2 or 4)


Description:  This function converts a hexidecimal string into its decimal equivalent.   The hexi_str value must be specified in little endian format (i.e lowest to highest byte order).    The num_bytes argument specifies whether 1, 2 or 4 bytes are to be converted.     If an invalid num_bytes value is given then it is assume to be a 1 byte conversion.


For example:


       // This returns -1

       int_val=hexistoint("FF",1);

       

       // This returns 255

       int_val=hexistoint("FF00",2);


       // This returns -1

       int_val=hexistoint("FFFF",2);


       // This returns 65535

       int_val=hexistoint("FFFF0000",4);

       


       // This returns        -268435456        

       int_val=hexistoint("00000010",4);


Returns:   Returns the decimal integer equivalent of the given hexi_str.