代码可以运行,提示i\o error 105,说是文件未打开,打开文件是用reset吧,我用了啊,为什么还是错误啊
var
f:textfile;
s:string;
sourcefile:string;
begin
sourcefile:='c:\asdf.txt';
if FileExists(sourcefile)=true then
begin
showmessage('asdf');
assignfile(f,sourcefile);
reset(f);
write(f,'test2');
//readln(f,s);
//form1.Edit1.Text:=s;
closefile(f);
end
//else if not fileexists('c:\asdf.txt') then
//assignfile(f,'c:\asdf.txt');
//rewrite(f);
//writeln(f,'test1');
//closefile(f);
end;
var
f:textfile;
s:string;
sourcefile:string;
begin
sourcefile:='c:\asdf.txt';
if FileExists(sourcefile)=true then
begin
showmessage('asdf');
assignfile(f,sourcefile);
reset(f);
write(f,'test2');
//readln(f,s);
//form1.Edit1.Text:=s;
closefile(f);
end
//else if not fileexists('c:\asdf.txt') then
//assignfile(f,'c:\asdf.txt');
//rewrite(f);
//writeln(f,'test1');
//closefile(f);
end;
解决方案 »
- 深圳地区求够一本Delphi 5开发人员指南
- 造假数一数........................
- access violation at address 004cd204 in module xxx.exe
- 如何加入组件?
- 帮我解决的,最高可给500分!!!!!!
- Treeview的节点上下移动问题——非鼠标拖拽的方法的实现!?
- 分数已经给你们了,我还有几句vb代码请你们转换为delphi语句,我最高分奉送。
- 有谁知道哪有《代码大全》卖的?
- 谢谢~请帮我看一下错误~这是个自动随机出题的小程序
- 一表我想通过文本框来增加记录,为何不能发送到表中,不要告诉我是没有post的原因。
- INI文件的问题,还望指教!
- 请问那里有Tbarcode for d6 下载
如果要重写文本文件用rewrite(),如果要在现有文件内容的基础上追加文本,用append();