请看这里为什么会有I/O错误?(10分)

  • 主题发起人 主题发起人 kevenzhang
  • 开始时间 开始时间
K

kevenzhang

Unregistered / Unconfirmed
GUEST, unregistred user!
assignfile(f,'c:/windows/system/qq.txt');
//reset(f);
Append(f);
writeln(f,trim(username.text));
Flush(f);
closefile(f);
 
procedure Flush(var t: Text);

Description

F is a text file variable.

When a text file is opened for output using Rewrite or Append, Flush empties the file's buffer. This guarantees that all characters written to the file at that time have actually been written to the external file. Flush has no effect on files opened for input.

Note: {$I+} handles run-time errors using exceptions. When using {$I-}, use IOResult to check for I/O errors.
 
声明
var

f: TextFile;
对吗?
 
我申明了
 
Var mstr:tstringlist;
begin
mstr:=tstringlist.create;
try
mstr.add(trim(username.text));
mstr.savetofile('c:/windows/system/qq.txt');
finally
mstr.free;
end;
end;
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
后退
顶部