Closed sxbug closed 1 year ago
You can use function DataToHex(InData: Pointer; ByteLength: Integer; UseUpperCase: Boolean = True): string; in CnNative.pas to directly convert the memory content of Float number to a hex string.
given
var A: Single; begin Caption := DataToHex(@A, SizeOf(A)); end;
thanksthanks
I only found the function: #1#2#3#4 <---> '1234'. But I want a function:12.5 <---> '41 48 00 00'
Thanks
Could you use my code piece and check the result?
var A: Single; begin A := 12.5; Result := DataToHex(@A, SizeOf(A)); end;
In above: function DataToHex(InData: Pointer; ByteLength: Integer; UseUpperCase: Boolean = True): string; is in cnvcl\Source\Crypto\CnNative.pas
Thank you for your guidance。
I misunderstand at first. Now I also want to know which function could convert # $41 48 00 00 to 12.5 , hex-->single。
Happy Chinese new year!
There's also a function HexToData in CnNative.pas
Note:
These compoments is very good, but there are a few documents。Thanks
cnFloat could conversion from 12.5 to C.8. Can it be converted to IEEE754's 41 48 00 00. I think this function is used a lot. thank you!