求delphi大神解答,这是对有类型文件进行删除删除的代码,求17-24行代码的解释!谢谢

发布时间:2019-07-29 16:49:09

implementation

type

 studentrecoed=record

   xh,xm:string[10];

   yw,sx,wy:integer;


procedure Tfrom1.Button3Click(Sender: TObject);

var

 pos:integer;

 t:studentrecoed;

 f:file of studentrecoed;

begin

  pos:=listbox1.ItemIndex;                    

  assignfile(f,'d:\my documents\文件.dat');    

  reset(f);                                   

  seek(f,pos+1);                            

  while not eof(f) do                   

  begin

    read(f,t);

    seek(f,pos);

    pos:=pos+1;

    write(f,t);

    seek(f,pos+1);

  end;

    seek(f,pos);  

    truncate(f);

    seek(f,0);

    listbox1.Items.Clear;

    while not eof(f) do

    begin

      read(f,t);

      listbox1.Items.Add(t.xh+'      '+t.xm+' '+inttostr(t.yw)+'      '+inttostr(t.wy)+'      '+inttostr(t.sx));

    end;

      closefile(f);

end;


推荐回答

还没有选出推荐答案,请稍候访问或查看其他回答!
以上问题属网友观点,不代表本站立场,仅供参考!