procedure TFrmPower.FormCreate(Sender: TObject);
var datafile:file;
   NumRead:integer;
   buf1,bUF2,buf3:string[30];
   Itm:TtreeNode;
begin
   Itm:=TreeView1.Items.GetFirstNode;
   assignfile(datafile,MainForm.FileIni);
    
   ReSet(datafile,1)提示错误如下 :
errorI/O 87
   error I/O 103
错误 行是Reset(datafile,1)

解决方案 »

  1.   

    function FileExists(FileName: string): Boolean;{ Boolean function that returns True if the file exists; otherwise,
      it returns False. Closes the file if it exists. }
     var
      F: file;
    begin
      {$I-}
      AssignFile(F, FileName);
      FileMode := 0;  {Set file access to read only }
      Reset(F);
      CloseFile(F);
      {$I+}
      FileExists := (IOResult = 0) and (FileName <> '');
    end;  { FileExists }begin  if FileExists(ParamStr(1)) then {Get file name from command line}
        Canvas.TextOut(10, 10, 'File exists')
      else
        Canvas.TextOut(10, 10, 'File not found');
    end;