procedure TForm1.Button1Click(Sender: TObject);
var
i:integer;
FromF: file;
NumRead: Integer;
Buf: array[1..512] of Byte;
str,s : string;
begin
if OpenDialog1.Execute then
begin
AssignFile(FromF, OpenDialog1.FileName);
Reset(FromF, 1);
repeat
str:= '';
BlockRead(FromF, Buf, SizeOf(Buf), NumRead);
for i := 1 to NumRead do
begin
Str := Str + InttoHex(Buf,2);
end;
if numread<>0 then
for i:=numread to 511 do
str:=str+'FF';
memo1.Lines.Add(str);
until (NumRead=0);
CloseFile(FromF);
end;
end;
buf就是每行的内容