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无法连接远程数据库实例 ...
随机推荐
- 06-python-生成器、循环器
生成器 生成器(generator)的主要目的是构成一个用户自定义的循环对象. 生成器的编写方法和函数定义类似,只是在return的地方改为yield.生成器中可以有多个yield.当生成器遇到一个y ...
- Python Yaml 学习
最近开始使用Python3.x,所有今后无特殊说明,Python代表的就是Python3.x 最近在看代码时发现有人用Yaml —— Yet Another Markup Language :另一种标 ...
- Unity--- 纹理设置属性 alphaIsTransparency
官方的解释: 意思就是没什么实际效果,只是用做显示用. 参考:https://docs.unity3d.com/ScriptReference/Texture2D-alphaIsTransparenc ...
- Asp.net core 学习笔记 (Excel 读写)
EPPlus 已经支持 .net core 了 https://www.nuget.org/packages/EPPlus https://github.com/JanKallman/EPPlus 写 ...
- java maven项目 pom.xml plugin 报错, build path 找不到 jconsole-1.8.0.jar 和 tools-1.8.0.jar 包
maven项目pom.xml突然报错,在Java Build Path 中并没有引用的jar包出现在了Maven Dependencies的依赖包中. 这个错误直接导致了pom.xml文件中 < ...
- Birdman Quotes
Popularity is the slutty little cousin of prestige (威望,声望) . A man becomes a critic when he cannot b ...
- LeetCode--434--字符串中的单词数
问题描述: 统计字符串中的单词个数,这里的单词指的是连续的不是空格的字符. 请注意,你可以假定字符串里不包括任何不可打印的字符. 示例: 输入: "Hello, my name is Joh ...
- Python实现一条基于POS算法的区块链
区块链中的共识算法 在比特币公链架构解析中,就曾提到过为了实现去中介化的设计,比特币设计了一套共识协议,并通过此协议来保证系统的稳定性和防攻击性. 并且我们知道,截止目前使用最广泛,也是最被大家接受的 ...
- 非常可乐 HDU - 1495
大家一定觉的运动以后喝可乐是一件很惬意的事情,但是seeyou却不这么认为.因为每次当seeyou买了可乐以后,阿牛就要求和seeyou一起分享这一瓶可乐,而且一定要喝的和seeyou一样多.但see ...
- Leetcode 692 - Note
1. 题目要求 Given a non-empty list of words, return the k most frequent elements. Your answer should be ...