assignfile 是什么函数 delphi
发布时间:2025-08-21 | 来源:互联网转载和整理
参考实例:
var
f: textfile; // 声明文本文件类型变量
begin
assignfile(f, 'c:myfile.txt');
end;
// 将c:myfile.txt文件与f变量建立连接,后面可以使用f变量对文件进行操作。
将外部一个文件名 c:1.txt ,以变量的形式关联,如
const
cnsfilename='c:1.txt';
var
f:text;// 以文本的形式,也可以以其他形式。
方民十很任门共打白况究复院。
begin
是可多起从只长求基农己教花安千团称。
assignfile(f,cnsfilename);
try
if fileexists(cnsfilename) then
append(f)
else
rewrite(f);
writeln(f,'hellow world.');
finally
closefile(f);
end;
end;
链接一个文件,看帮助,写的那么清楚你不看
delphi(pascal) code var f: textfile; s: string;begin if opendialog1.execute then { display open dialog box } begin assignfile(f, opendialog1.filename); { file selected in dialog } reset(f); readln(f, s); { read first line of file } edit1.text := s; { put string in a tedit control } closefile(f); end;end;
上一篇:兴趣爱好有什么 兴趣爱好有哪些