如何用DELPHI从二进制文件中读取单精度浮点数?
如题,请各位老师指导。急
mmo1: TMemo;
procedure TForm1.btn1Click(Sender: TObject);
var
avar: Pointer;
begin
avar:= AllocMem(SizeOf(Single)); //分配buf
try
pint(avar)^:= $45993dcb; //仿真读取的数据
mmo1.Lines.Add(FloatToStr(psingle(avar)^)); //按单精度浮点解释并转换为字符串显示
finally
FreeMem(avar);
end;
end;