Delphi I/O error 103 错误
http://stackoverflow.com/questions/634587/delphi-why-do-i-sometimes-get-an-i-o-error-103-with-this-code
I don't see what is wrong with automatic retry. I don't see that you can do anything else.
If some other process is reading the file, then your Append/Rewrite will fail.
假如某个其他进程正在读取这个问题,这时你做Append Rewite 操作的话就会出错。
And since the file is a log, there is a good chance that something, such as a log viewer or a text editor, will be reading it at the instant you try to open it.
Try opening the file a few times with a delay in-between attempts before failing definitively.
在明确失败前,试试打开以一定的间隔打开这个文件几次。
You could use an exponential backoff if you wanted to be fancy.
你可以用一个变量控制。
try
ReWrite(MyFileHandler); // This sometimes fails
except
ReWrite(MyFileHandler); // When prior fails, this runs OK
end;
用户环境:
使用该软件已经快8年了,最近安装了360卫士和杀毒。
保存时提示该错误。
其他:
http://stackoverflow.com/questions/22026948/how-do-i-solve-i-o-error-103-in-delphi
http://stackoverflow.com/questions/16287983/why-do-i-get-i-o-error-32-even-though-the-file-isnt-open-in-any-other-program
http://mc-computing.com/languages/delphi/delphifileio.htm
测试:
procedure TForm1.Button1Click(Sender: TObject);
var
F,n: TextFile;
const
filestr = 's:\test.txt';
begin
AssignFile(f, filestr);
Append(f);// 不存在这个文件时,报File not found;存在时 无报错。
end
procedure TForm1.Button1Click(Sender: TObject);
var
F,n: TextFile;
const
filestr = 's:\test.txt';
begin
// AssignFile(f, filestr);//无这行 报I/O error 102
Append(f);
// Rewrite(f);
// Writeln(f, 'abcs:\');
// CloseFile(f);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
F,n: TextFile;
const
filestr = 's:\test.txt';
begin
AssignFile(f, filestr);//无这行 报I/O error 102
Append(f);
Append(f);//第二次时点击按钮时 报 I/O error 32 资源管理器里删除该文件的话,提示 已经被其他程序打开 end;
procedure TForm1.Button1Click(Sender: TObject);
var
F,n: TextFile;
const
filestr = 's:\test.txt';
begin
AssignFile(f, filestr);
// Append(f);//无这行,报 I/O error 103
CloseFile(f);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
F,n: TextFile;
const
filestr = 's:\test.txt';
begin
AssignFile(f, filestr);
Append(f); Writeln(f, 'abcs:\');
CloseFile(n);//n变量 未关联文件时,报103
end;
可能的原因:
1、Append时,
Delphi I/O error 103 错误的更多相关文章
- 远程桌面下启动MATLAB时的License Manager Error -103错误
之前使用学校提供的正版lincense,是通过MATLAB 官网注册下载的MATLAB 2017a,远程登录可用打开.后来学校停止购买了,时间紧迫,网上下载了一个standalone的lincense ...
- Delphi 通信报Asynchronous socket error 10053错误的一个解决方法
在使用Delphi中的TClientSocket和TServerSocket进行通信编程时,当使用TClientSocket这方的客户端使用TClientSocket.close断开连接并退出程序时, ...
- com.sun.jdi.internalException:Unexpected JDWP Error:103////Method threw 'java.lang.IllegalArgumentEx
retrofit2+RxJava2 的一些坑 今天开发新项目,本着积极向上的学习态度,经过多番考虑我决定使用retrofit2 + RxJava2来做为我的网络请求......神说:你的想法非常好 先 ...
- 解决ngnix服务器上的Discuz!x2.5 Upload Error:413错误
1.修改php.ini sudo nano /etc/php5/fpm/php.ini #打开php.ini找到并修改以下的参数,目的是修改上传限制 max_execution_time = 900 ...
- ArcGIS10.1 api for Flex开发用于ArcGIS 9.3时QueryTask 'Error #2032'错误的解决方案
因客户GIS软件需求,将应用降级到低版本ArcGIS9.3,不仅数据有些样式.配色.字符有些问题,API也要相应“降级”,解决如下: 利用9.3+flex做QueryTask时候出现了[RPC Fau ...
- AjaxControlToolkit MaskedEdit Unspecified error 未指定错误
使用AjaxControlToolkit 里面的 MaskedEditValidator控件,IE里面在如下的js中出现未指定(Unspecified error)错误, if (document.a ...
- XCODE 出现 The operation couldn't be completed.(LaunchServicesError error 0.)错误修复
XCODE 出现 The operation couldn't be completed.(LaunchServicesError error 0.)错误修复 XCODE 出现 The opera ...
- Installation error INSTALL_FAILED_VERSION_DOWNGRADE错误
最近折腾了一下Robotium自动化测试框架,发现问题还挺多,刚刚解决了一个问题,总算是把环境搞定了,可是一运行测试用例,发现又报Installation error INSTALL_FAILED_V ...
- 解决SQL Server管理器无法连接远程数据库Error: 1326错误
解决SQL Server管理器无法连接远程数据库Error: 1326错误 我们在在使用SQL Server时都会遇到使用SQL Server Management Studio无法连接远程数据库实例 ...
随机推荐
- NGUI实现的一套不同大小 Item 的循环滚动代码
测试: 数据 & Item 的 Ctrl : using UnityEngine; public class ScrollViewItemData { public int index; p ...
- python中进程间通讯——文件锁之fcntl模块的使用
python 中给文件加锁——fcntl模块import fcntl 打开一个文件##当前目录下test文件要先存在,如果不存在会报错.或者以写的方式打开f = open('./test')对该文件加 ...
- Advances in Single Cell Genomics to Study Brain Cell Types | 会议概览
单细胞在脑科学方面的应用 Session 1: Deciphering the Cellular Landscape of the Brain Using Single Cell Transcript ...
- SSD: ReLU6
1.在src\caffe\proto\caffe.proto中搜索message LayerParameter,在optional ReLUParameter relu_param = 123之后添加 ...
- RFBnet论文笔记
论文:Receptive Field Block Net for Accurate and Fast Object Detection 论文链接:https://arxiv.org/abs/1711. ...
- P2375 [NOI2014]动物园
考虑kmp. 这个题的主要问题就在于怎样使复杂度是正确的O(n). 可以先预处理一个数组cnt[]表示不考虑不能相交这个限制,有多少个border. 这个东西其实也就是fail树上的深度. 然后考虑怎 ...
- Excel文件的读写
import xlsxwriter,xlrd import sys,os.path fname = 'zm6.xlsx' if not os.path.isfile(fname): print ('文 ...
- Nginx配置——区分PC或手机访问不同域名
新官网上线,但在手机上访问新官网的体验很差,要求在手机上访问新官网时访问旧官网,可以通过修改Nginx配置来实现自动跳转.首先是新官网的Nginx配置文件加个跳转判断,通过user-agent判断来源 ...
- SQLserver如何创建一个表
例如: create table news(news_id int primary key identity(1,1),news_title varchar(50) not null,news_aut ...
- Spring注解之@Lazy注解
@Lazy用于指定该Bean是否取消预初始化.主要用于修饰Spring Bean类,用于指定该Bean的预初始化行为, 使用该Annotation时可以指定一个boolean型的value属性,该属性 ...