hextobin,bintohex用法

来源:互联网 发布:药典 有软件吗 编辑:程序博客网 时间:2024/06/05 10:35
procedure TForm1.Button1Click(Sender: TObject);var E: Extended; //Make sure there is room for null terminator Buf: array[0..SizeOf(Extended) * 2] of Char;begin E := Pi; Label1.Caption := Format('Pi starts off as %.15f', [E]); BinToHex(@E, Buf, SizeOf(E)); Buf[SizeOf(Buf) - 1] := #0; Label2.Caption := Format('As text, the binary contents of Pi look like %s', [Buf]); HexToBin(Buf, @E, SizeOf(Buf) - 1); Label3.Caption := Format('Back from text to binary,Pi is now %.15f', [E]);end;