1.在这段程序中seek()函数能给我具体解释一下它的使用吗!包括它的使用,和它的
参数.
2.seek(-getrecsize ,1)中(-getrecsize )为什么是负的?..........................
function trecordstream.getrecsize:longint;
begin
result:=sizeof(tpersonrec);
end;
...............procedure trecordstream.first;
begin
seek(0,0);
end;procedure trecordstream.last;
begin
seek(0,2);
seek(-getrecsize,1);
end;procedure trecordstream.nextrec;
begin
if ((position + getrecsize) div getrecsize)=getnumrecs then
raise exception.create('cannot read beyond end of file')
else
seek(getrecsize,1);
end;procedure trecordstream.previousrec;
begin
if (position - getrecsize>=0) then
seek(-getrecsize ,1)
else
raise exception.create('Cannot go beyond beginning of file');
end;
参数.
2.seek(-getrecsize ,1)中(-getrecsize )为什么是负的?..........................
function trecordstream.getrecsize:longint;
begin
result:=sizeof(tpersonrec);
end;
...............procedure trecordstream.first;
begin
seek(0,0);
end;procedure trecordstream.last;
begin
seek(0,2);
seek(-getrecsize,1);
end;procedure trecordstream.nextrec;
begin
if ((position + getrecsize) div getrecsize)=getnumrecs then
raise exception.create('cannot read beyond end of file')
else
seek(getrecsize,1);
end;procedure trecordstream.previousrec;
begin
if (position - getrecsize>=0) then
seek(-getrecsize ,1)
else
raise exception.create('Cannot go beyond beginning of file');
end;
参数1就是向前移1