Home > Net > How to convert a hexadecimal bytes to a signed integer?
How to convert a hexadecimal bytes to a signed integer?
Time:01-14
As title, Dim UBI_A1 As String=CShort (" & amp; H "& amp; Turn "E0") 'hexadecimal decimal Get is 224, but should be - 32 is right the results
Could you tell me how to modify a great god get a signed integer
CodePudding user response:
VB single-byte type declaration only BYTE, but it is unsigned 0 ~ 255; Other integer type is 2 bytes or more bytes, & amp; HE0 casts into other integer cannot be negative, Single-byte integer to convert a negative number whether need to do a greater than & amp; H7F judgment, Dim UBI_A1 As Short=CShort (" & amp; H "& amp; "E0") If UBI_A1 & gt; & H7F Then UBI_A1=UBI_A1 - & amp; H100 End If