1.得到文件名
2.Seek(偏移量,启始位置);

解决方案 »

  1.   

    你看帮助文件吧,里面很全的。在ExtractFileName上按F1.
      

  2.   

    1。得到文件名的信息。
    2。Seek(var F; N: Longint); 其中F为文件,N为偏移量。就是将文件指针后移。
      

  3.   

    Seek(var f:File;N:longInt)
    procedure TForm1.Button1Click(Sender: TObject);var
       f: file of Byte;
       size: Longint;
       S: string;
       y: Integer;
    begin
      if OpenDialog1.Execute then
      begin
        AssignFile(f, OpenDialog1.FileName);
        Reset(f);
        try
          size := FileSize(f);
          S := 'File size in bytes: ' + IntToStr(size);
          y := 10;
          Canvas.TextOut(5, y, S);
          y := y + Canvas.TextHeight(S) + 5;
          S := 'Seeking halfway into file...';
          Canvas.TextOut(5, y, S);      y := y + Canvas.TextHeight(S) + 5;
          Seek(f, size div 2);
          S := 'Position is now ' + IntToStr(FilePos(f));
          Canvas.TextOut(5, y, S);
        finally
          CloseFile(f);
        end;
      end;
    end;