关于网友提出的“ 关于{$IOCHECKS ON}的问题,高手帮帮忙,谢谢!!”问题疑问,本网通过在网上对“ 关于{$IOCHECKS ON}的问题,高手帮帮忙,谢谢!!”有关的相关答案进行了整理,供用户进行参考,详细问题解答如下:
问题: 关于{$IOCHECKS ON}的问题,高手帮帮忙,谢谢!!
描述: 我做了一个应用,是时间程序来的,当我启动程序后,要打开另外的一个窗口(选项),设置一些参数,然后确定回到主窗口,启动主程序应用,这个是主程序是根据一定的时间查找文件和解析文件,及从数据库中查找符合一定的条件的数据,然后生成文件。而选项里的设置是,将一些参数写入到INI文件中和新建目录,如下:
{$I-}
MkDir(lePathLocal.Text + '\bw');
MkDir(lePathLocal.Text + '\hz');
MkDir(lePathLocal.Text + '\log');
MkDir(lePathLocal.Text + '\convene');
MkDir(lePathLocal.Text + '\convene\bwzip');
MkDir(lePathLocal.Text + '\convene\hzzip');
MkDir(lePathLocal.Text + '\convene\temp');
MkDir(lePathLocal.Text + '\convene\bw');
MkDir(lePathLocal.Text + '\convene\hz');
MkDir(lePathLocal.Text + '\convene\backup');
MkDir(lePathLocal.Text + '\convene\backup\bw');
MkDir(lePathLocal.Text + '\convene\backup\hz');
MkDir(lePathLocal.Text + '\convene\backup\log');
MkDir(lePathLocal.Text + '\convene\backup\basecode');
MkDir(lePathLocal.Text + '\convene\basecode');
MkDir(lePathLocal.Text + '\convene\ErrorFile');
//最大行数
WriteINI('SYSTEM','MAXLINE',leMaxLine.Text);
//保存日志选项
WriteINI('SYSTEM','SaveLogOption',intToStr(combobox1.ItemIndex));
//运行始末时间
WriteINI('PARM','TIME_BEGIN',timeToStr(TPicker_Parm1.Time));
WriteINI('PARM','TIME_END',timeToStr(TPicker_Parm2.Time));
可是每次从数据库取出数据,然后形成文件的时候总是报错,错误提示如下:
---------------------------
Debugger Exception Notification
---------------------------
Project FExchange.exe raised exception class EInOutError with message 'I/O error 183'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
我是这样建立文件的:
try
AssignFile(F, fn);
Rewrite(F);
except
CloseFile(F);
Continue;
end;
要是,不打开选项的窗口,则不会出现这样的错误提示
大家帮忙看看有什么问题???
解决方案1: 可以用判断来做
DirectoryExists,这个函数应该可以满足你的要求。
比如:
try
if not DirectoryExists(lePathLocal.Text + '\convene\backup\bw') then
MkDir(lePathLocal.Text + '\convene\backup\bw');
except
end;
先判断,然后在看是否新建目录,最好加上TRY...EXCEPT
以上介绍了“ 关于{$IOCHECKS ON}的问题,高手帮帮忙,谢谢!!”的问题解答,希望对有需要的网友有所帮助。
本文网址链接:http://www.codes51.com/itwd/3227511.html