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无法连接远程数据库实例 ...
随机推荐
- English trip EM2-LP-1B Favorite Things Teacher:William Full name: Willian Richard Ogzrd 威廉理查德·奥格兹德
课上内容(Lesson) # music pop 流行音乐 light music 轻音乐 rep 说唱音乐 rack 摇滚乐 classic 古典乐 hip-hop n. 街舞,即兴音乐:嘻哈 ...
- English trip V1 - B 22. Here,There and Everywhere 无处不在 Teacher:Taylor Key: Be + Ving
In this lesson you will learn to describe what you see. 课上内容(Lesson) # How's the weather today? 今天的天 ...
- Luffy之Xadmin以及首页搭建(轮播图,导航)
1. 首页 1.1 轮播图 admin站点配置支持图片上传 pip install Pillow 默认情况下,Django会将上传的图片保存在本地服务器上,需要配置保存的路径.我们可以将上传的文件保存 ...
- python基础之 026 包以及包的引入
内容梗概: 1. from xxx import xxx知识点补充 2. 包 1. 知识点补充. 我们现在知道可以使⽤用import和from xxx import xxx来导入一个模块中的内容.那有 ...
- 如何设置Git SSH密钥
1. SSH 存储在user/用户名/.ssh文件夹下 生成SSH密钥 $ ssh-keygen -t rsa -C "your_email" 2. 查看生成的公钥 $ cat ~ ...
- GPLT L2-014 列车调度
题目链接:https://pintia.cn/problem-sets/994805046380707840/problems/994805063166312448 分析:明显从右到左列车的序号需要依 ...
- 『计算机视觉』Mask-RCNN
一.Mask-RCNN流程 Mask R-CNN是一个实例分割(Instance segmentation)算法,通过增加不同的分支,可以完成目标分类.目标检测.语义分割.实例分割.人体姿势识别等多种 ...
- 【MySQL】【3】String和Date相互转换
正文: 1,Date转String --结果:<2019-04-10> SELECT DATE_FORMAT(SYSDATE(), "%Y-%m-%d") FROM D ...
- leetcode-algorithms-36 Valid Sudoku
leetcode-algorithms-36 Valid Sudoku Determine if a 9x9 Sudoku board is valid. Only the filled cells ...
- HTTP及RFC解析。
HTTP协议描述的是发送方与接收方的通信协议,通过两方的自觉遵守而存在,当然有不少的浏览器并没有百分百遵守这份协议.HTTP是运行于应用层的协议,基于TCP协议而运作.基本上是客户/服务器对答模式,其 ...