delphi写文本文件


本文整理自网络,侵删。

 procedure TForm1.Button1Click(Sender: TObject);
var
LogFile: TextFile;
begin
if not FileExists('c:\Log1.txt') then
begin
AssignFile(LogFile, 'c:\Log1.txt');
Rewrite(LogFile);
CloseFile(LogFile); //关闭时自动保存文件
end;

AssignFile(LogFile, 'c:\Log1.txt');
Append(LogFile);

writeln(LogFile);
writeln(LogFile, '*********End**********');
writeln(LogFile);
writeln(LogFile, '********begin*********');
Write(LogFile, 'Begin the same line');
Write(LogFile, '//the same line');
CloseFile(LogFile);
end;

相关阅读 >>

Delphi android服务向导

Delphi tms web core js callproc

github上通过星级评估排名前10的最受欢迎的开源Delphi项目

Delphi tgauge类的定义在哪个单元中定义的?

Delphi xe10 给程序添加uac权限

Delphi ansi字符串转unicode编码

Delphi bmp jpg 转换保存

Delphi一个综合实用的单元

Delphi Delphi写的一个上位机

Delphi把一个字符串中的某个子串,用另一个子串去替换

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...