procedure TForm1.Button9Click(Sender: TObject);
      var
   pos:integer;
    p:precord;
    f:file of precord;
begin
  pos:=listbox1.ItemIndex;
assignfile(f,'f:\shuju2\p.dat');
pos:=listbox1.ItemIndex;
 if fileexists('f:\shuju2\p.dat') then
     reset(f)
       else
         rewrite(f);
           seek(f,0);
           listbox1.Items.Clear;
           seek(f,pos-1);
  while not eof(f) do
  begin
   read(f,p);
    listbox1.Items.Add(p.xm+' '+p.sr+' '+p.dh+' '+p.xb+' '+p.mz+' '+p.ah);
    edit1.Text:=p.xm;
   maskedit1.Text:=p.sr;
   maskedit2.Text:=p.dh;
end;
end;end.运行老是seek(f,pos-1);出错
我这段代码的目的是想,先通过  pos:=listbox1.ItemIndex;来确定文件的位置,然后通过seek(f,pos-1)来指向上一个位置,然后把上一个文件内容显示出来········