All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
delphi CloseFile过程关闭文件

Writer: aaa Article type: Programming skills(编程技巧) Time: 2014/7/19 0:08:29 Browse times: 300 Comment times: 0

delphi CloseFile过程关闭文件


Head photo

Go homepage
Upload pictures
Write articles

delphi CloseFile过程关闭文件

CloseFile 过程
CloseFile 过程用来关闭文件,同时将文件记录盘上的文件与相关文件变量断开联系。过程原型如下:
procedure CloseFile(var F);
通常将CloseFile 语句放在Finally 语句块中执行,这样,一旦文件操作代码出现异常也可以关闭文件。例如上面Append 过程的代码可以用Finally 语句编写,以保证关闭文件。
var
F:TextFile;
begin
if OpenDialog1.Execute then
begin
AssignFile(F,OpenDialog1.FileName);
try
Append(F);
Writeln(F,’写入一行内容’);
finally
CloseFile(F);
end;
end;
end;





There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.