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 错误的更多相关文章

  1. 远程桌面下启动MATLAB时的License Manager Error -103错误

    之前使用学校提供的正版lincense,是通过MATLAB 官网注册下载的MATLAB 2017a,远程登录可用打开.后来学校停止购买了,时间紧迫,网上下载了一个standalone的lincense ...

  2. Delphi 通信报Asynchronous socket error 10053错误的一个解决方法

    在使用Delphi中的TClientSocket和TServerSocket进行通信编程时,当使用TClientSocket这方的客户端使用TClientSocket.close断开连接并退出程序时, ...

  3. com.sun.jdi.internalException:Unexpected JDWP Error:103////Method threw 'java.lang.IllegalArgumentEx

    retrofit2+RxJava2 的一些坑 今天开发新项目,本着积极向上的学习态度,经过多番考虑我决定使用retrofit2 + RxJava2来做为我的网络请求......神说:你的想法非常好 先 ...

  4. 解决ngnix服务器上的Discuz!x2.5 Upload Error:413错误

    1.修改php.ini sudo nano /etc/php5/fpm/php.ini #打开php.ini找到并修改以下的参数,目的是修改上传限制 max_execution_time = 900 ...

  5. ArcGIS10.1 api for Flex开发用于ArcGIS 9.3时QueryTask 'Error #2032'错误的解决方案

    因客户GIS软件需求,将应用降级到低版本ArcGIS9.3,不仅数据有些样式.配色.字符有些问题,API也要相应“降级”,解决如下: 利用9.3+flex做QueryTask时候出现了[RPC Fau ...

  6. AjaxControlToolkit MaskedEdit Unspecified error 未指定错误

    使用AjaxControlToolkit 里面的 MaskedEditValidator控件,IE里面在如下的js中出现未指定(Unspecified error)错误, if (document.a ...

  7. XCODE 出现 The operation couldn't be completed.(LaunchServicesError error 0.)错误修复

    XCODE 出现 The operation couldn't be completed.(LaunchServicesError error 0.)错误修复   XCODE 出现 The opera ...

  8. Installation error INSTALL_FAILED_VERSION_DOWNGRADE错误

    最近折腾了一下Robotium自动化测试框架,发现问题还挺多,刚刚解决了一个问题,总算是把环境搞定了,可是一运行测试用例,发现又报Installation error INSTALL_FAILED_V ...

  9. 解决SQL Server管理器无法连接远程数据库Error: 1326错误

    解决SQL Server管理器无法连接远程数据库Error: 1326错误 我们在在使用SQL Server时都会遇到使用SQL Server Management Studio无法连接远程数据库实例 ...

随机推荐

  1. Robot framework--内置库xml学习(一)

    Using lxml By default this library uses Python's standard ElementTree module for parsing XML, but it ...

  2. Python学习笔记之参数解析

    python提供了两种方法进行命令行的参数解析,分别是getopt和optparse类中的模块OptionParser,下面分别详细了解这两个模块: 1.getopt模块 首先复习C语言的命令行解析: ...

  3. 为 昂达 v891 安装上了 remix OS 了

    起因: 默认的ROM自带一堆垃圾app,最主要的是没有root , 所以卸载不了. 然后试了 Root大师 , 刷机精灵 之类的软件. 我 CTMD , 简直比出厂ROM 还流氓, 不断的强制安装各种 ...

  4. 放弃 Tightvnc, 选择 Tigervnc

    构建headless vnc server ,我终于放弃了Tightvnc 基于以下原因: 1) 已知的Qt5的键盘映射问题,导致virtualbox 的使用出现困难 https://unix.sta ...

  5. FireFox(火狐)浏览器的相关问题

    如何加快FireFox(火狐)浏览器浏览网页速度 大部分网页加载缓慢的原因:1.宽带连接.网速不稳定2.浏览器本身问题,如果多开窗口浏览会占大量内存,而且磁盘空间没有做过优化,就这样电脑资源不够用,也 ...

  6. 新C# 操作Excel属性

    C# 操作Excel属性 数字(Range.NumberFormatlocal 属性) 常规:Range.NumberFormatlocal = "G/通用格式" 数值:Range ...

  7. 【源码分析】Mybatis使用中,同一个事物里,select查询不出之前insert的数据

    一.问题场景模拟问题:第二次查询和第一次查询结果一模一样,没有查询出我新插入的数据 猜测:第二次查询走了Mybatis缓存 疑问:那为什么会走缓存呢? 1.service方法 @Override @T ...

  8. oracle 查看被锁表 及解除锁定

    查看 哪些表 被锁了 SELECT object_name, machine, s.sid, s.serial# FROM gv$locked_object l, dba_objects o, gv$ ...

  9. 2. 搭建DRF项目

    企业项目开发流程 一.需求分析 1.企业的web项目类型: 商城 门户网站[企业站和门户站] 社交网络 资讯论坛 内部系统 个人博客 内容收费站 前端的静态页面制作,外界开发的时候,是照着psd/pn ...

  10. Two Melodies CodeForces - 813D (DP,技巧)

    https://codeforces.com/problemset/problem/813/D dp[i][j] = 一条链以i结尾, 另一条链以j结尾的最大值 关键要保证转移时两条链不能相交 #in ...