|
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; //保留字节 ???
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;
如上的代码为何Seek的第二个参数等于0,1或者2的时候读出来的数据都不对.等于3或者更大的数字的时候就对了呢?这个不是只定义了0,1和2这三个操作方法吗? |
|