|
type
TStorage = packed record
bt01: byte;
sName: string [14];
SaveDate: TDateTime;
dwMakeIdx: DWord;
wIndex: Word;
wDura: Word;
wDuraMax: Word;
nValue: array [0..13] of Byte;
nNone: Integer; // Reserved bytes ???
end;
procedure TForm1.btn1Click (Sender: TObject);
var
Stor: TStorage;
I, nCount: Integer;
Files: TFileStream;
begin
Files: = TFileStream.Create (Pchar (edt1.text), fmOpenReadWrite or fmShareDenyNone);
Files.Read (nCount, SizeOf (Integer));
for I: = 1 to nCount do
begin
Files.Read (Stor, SizeOf (TStorage));
Files.Seek (I * SizeOf (TStorage), 3);
mmo1.Lines.Add (IntToStr (Stor.wIndex-1));
end;
end;
The code above is why the data read when the second parameter of Seek is equal to 0, 1 or 2 is not correct. It is correct when it is equal to 3 or larger numbers. This is not only defined 0, 1 and 2 Are there three methods of operation? |
|