var
datafile:file;reset(datafile,1)

解决方案 »

  1.   

    I/O 103 表示文件已关闭
    一般的,在使用reset打开文件之前,需要先调用assignfile
      

  2.   

    先 assignfile以下,然后在reset就可以了!
      

  3.   

    我已经调用了assignfile了,在调用了assignfile之后,再使用reset的,可是仍然出现这种错误,我都快没招了.
      

  4.   

    var myfile:textfile;
        temp:string;
                 if fileexists('xxx.txt') then  begin
                    try
                       AssignFile(myfile,'xxx.txt');//这一步是将文件名赋给MYFILE
                       reset(myfile);
                       readln(myfile,temp);
                    finally
                       closefile(myfilefile);
                    end;
                 end;
      

  5.   

    function FileIsThere(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+}
      FileIsThere := (IOResult = 0) and (FileName <> '');
    end;  { FileIsThere }begin if FileIsThere(ParamStr(1)) then {Get file name from command line}
        Canvas.TextOut(10, 10, 'File exists')
      else
        Canvas.TextOut(10, 10, 'File not found');
    end;