I/O完成操作的状态是指完成的什么?
ioresult<>0说明了什么  等于0又说明了什么?

解决方案 »

  1.   

    var
      F: file of Byte;
    begin
      if OpenDialog1.Execute then
      begin
        AssignFile(F, OpenDialog1.FileName);
        {$I-} // 让编译器忽略io检查,否则当io出现问题的时候会弹出错误对话框
        Reset(F);
        {$I+}
        if IOResult = 0 then //返回0表示没有出现错误
        begin
          MessageDlg('File size in bytes: ' + IntToStr(FileSize(F)),
            mtInformation, [mbOk], 0);
          CloseFile(F);
        end
        else //否则返回非0表示io有错
          MessageDlg('File access error', mtWarning, [mbOk], 0);
      end;end;