用BlockRead读取记录文件,举个例子:<br><br>unit Unit1;<br><br>interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls;<br><br>type<br> TForm1 = class(TForm)<br> Button1: TButton;<br> Memo1: TMemo;<br> Memo2: TMemo;<br> Button2: TButton;<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> procedure ShowData;<br> public<br> { Public declarations }<br> end;<br><br>type<br> TMyData = packed record<br> w: packed array[0..2]of word;<br> dw: packed array[0..8]of dword;<br> end;<br><br>var<br> Form1: TForm1;<br> f:file of TMyData;<br> Data: TMyData;<br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm1.ShowData;<br>begin<br> with Data do<br> memo1.Lines.Add(format('w1:%g,w2:%g,w3:%g,dw1:%g,dw2:%g,dw3:%g',[w[0]/100,w[1]/100,w[2]/100,dw[0]/100000,dw[1]/100000,dw[2]/100000]));<br>end;<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br> NumRead:integer;<br>begin<br><br> caption := inttostr(Sizeof(Data));<br> assignfile(f,'T0105.101');<br> Reset(f);<br> BlockRead(f,Data,Sizeof(Data),NumRead);<br> closefile(f);<br> ShowData;<br><br>end;<br><br>end.<br>