How to convert Hex into readable values

  • Thread starter Thread starter aaa
  • Start date Start date
A

aaa

I have a third party DLL that downloads everything from a device to a
particular device into the following Hex format:

080 : 13 70 05 00 (Timestamp)
081 : 35 E1 91 F9 9F BF (Mode 1 Supported Parameters)

How would I go about translating this into readable values?
 
I assume that you're interested in converting from hex values to integers.
In this case I recommend the following:

Convert.ToInt16( string, base );
Convert.ToInt32( string, base );
Convert.ToInt64( string, base );

Each of these returns the respective integer. <string> is a string
containing the data to convert. <base> is the number base and must have a
value of 2, 8, 10 or 16.

..ARN.
 
Try the following:

1) Take the spaces out of the string
2) use a base of 16 (for hexadecimal)

like this:

int i = Convert.ToInt32( "B30C0020", 16 );

When I tried this, I got a value of -1291059168 for i.

Using the following gave me a value of 3003908128:

Int64 i = Convert.ToInt64("B30C0020", 16 );

..ARN.
 
Back
Top