I/O error 32! 什么意思?(50分)

  • 主题发起人 主题发起人 cao192
  • 开始时间 开始时间
C

cao192

Unregistered / Unconfirmed
GUEST, unregistred user!
运行后,出现如题错误。怎么回事儿?<br><br>procedure TForm1.Button1Click(Sender: TObject);<br>var<br>i:integer;<br>F:TextFile;<br>ErrFileName:string;<br>begin<br>try<br>i:=trunc(3 div strtoint(edit1.Text));<br>Except<br>&nbsp; ErrFileName:=ExtractFilePath(Application.ExeName)+FormatDateTime('yymmddhhmmss',now)+'.DAT';<br>&nbsp; if Not FileExists(ErrFileName) then FileCreate(ErrFileName);<br>&nbsp; AssignFile(F,ErrFileName);<br>&nbsp; Rewrite(F);<br>&nbsp; writeln(F,'asdfasdf1654654654');<br>&nbsp; CloseFile(F);<br>end;<br>end;<br><br><br>哪里有错误表可以下载<br>
 
其他进程正在使用文件,无法打开文件。<br>你可以用showmessage(syserrormessage(32));来显示错误信息。<br>
 
建议你用文件流来做, 效果跟好
 
//if Not FileExists(ErrFileName) then FileCreate(ErrFileName);<br>再试试.文本文件只要AssignFile就行。
 
FileHandle:=FileCreate(ExtractFilePath(Application.ExeName)+FormatDateTime('yymmddhhmmss',now)+'.DAT');<br>&nbsp; case comflag of<br>&nbsp; 6: &nbsp;begin<br>&nbsp; &nbsp; &nbsp; FileWrite(FileHandle,rbuf[1],rbuf[3]+rbuf[4]*256);<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; 7: &nbsp;begin<br>&nbsp; &nbsp; &nbsp; FileWrite(FileHandle,obuf[1],obuf[2]*30+12);<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; end;<br>&nbsp; FileClose(FileHandle);<br>&nbsp; showmessage('数据传送有错误,请查看记录文件');[:D]
 
多人接受答案了。
 
后退
顶部