G
gz_yxc
Unregistered / Unconfirmed
GUEST, unregistred user!
各位大虾,请帮忙看以下代码,不知道为何返回结果与我先前写入的不一致?
procedure TForm1.Button1Click(Sender: TObject);
var
myfile:TfileStream;
name:string;
tmpchar;
i,j:integer;
begin
getmem(tmp,10);
name:='d:/test.exe';
myfile:=Tfilestream.Create(name,fmOpenRead or fmShareExclusive);
myfile.Seek(-8,soFromEnd);
i:=myfile.Read(tmp^,8);
edit1.Text:=tmp^;
edit2.Text:=inttostr(i);
myfile.Free;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
myfile:TfileStream;
name:string;
tmpchar;
i,j:integer;
begin
getmem(tmp,10);
name:='d:/test.exe';
myfile:=Tfilestream.Create(name,fmOpenRead or fmShareExclusive);
myfile.Seek(-8,soFromEnd);
i:=myfile.Read(tmp^,8);
edit1.Text:=tmp^;
edit2.Text:=inttostr(i);
myfile.Free;
end;