Delphi将字符串写入text文档
来源:互联网 发布:大疆 知乎 编辑:程序博客网 时间:2024/06/06 23:54
procedure TForm1.Button1Click(Sender: TObject);
var
afile: TFileStream;
begin
if not FileExists('c:\a.txt') then
begin
try
afile := TFileStream.Create('c:\a.txt', fmCreate);
afile.WriteBuffer(PChar(Edit1.Text + #13#10)^, Length(Edit1.Text + #13#10));
finally
afile.Free;
end;
end
else begin
try
afile := TFileStream.Create('c:\a.txt', fmOpenWrite);
afile.Seek(0, soEnd);
afile.WriteBuffer(PChar(Edit1.Text + #13#10)^, Length(Edit1.Text + #13#10));
finally
afile.Free;
end;
end;
end;
var
afile: TFileStream;
begin
if not FileExists('c:\a.txt') then
begin
try
afile := TFileStream.Create('c:\a.txt', fmCreate);
afile.WriteBuffer(PChar(Edit1.Text + #13#10)^, Length(Edit1.Text + #13#10));
finally
afile.Free;
end;
end
else begin
try
afile := TFileStream.Create('c:\a.txt', fmOpenWrite);
afile.Seek(0, soEnd);
afile.WriteBuffer(PChar(Edit1.Text + #13#10)^, Length(Edit1.Text + #13#10));
finally
afile.Free;
end;
end;
end;
0 0
- Delphi将字符串写入text文档
- 通过宏将字符串信息写入到odt文档
- java中,将一串字符串写入到本地文档中
- 将字符串写入文件
- 将字符串写入文件
- 将字符串写入文本文件
- 将字符串写入磁盘
- 将字符串写入文件
- 将XML文档写入数据库
- 将XML文档写入数据库
- 将信息写入txt文档
- php将数组写入文档
- 将内容写入xml文档
- delphi将字符串写入txt文本,每次写入,末尾自动加换行符,不会清空之前的数据
- C# 将List写入到Text文本
- 将字符串写入txt中
- Delphi往注册表写入字符串、REG_DWORD、二进制
- Java将数据写入word文档(.doc)
- 软工概述
- C++和JAVA的区别
- WeakHashMap 笔记
- C语言,你真的弄懂了么?
- POJ 2485 Highways(最短路)
- Delphi将字符串写入text文档
- STL源码剖析一——STL概论
- CGI 搜集资料(本网站已经收藏,非原创,以备遗忘,均未测试,有待测试验证)。(感谢所有提供者)
- struts2 实现输入校验之validate方法
- supervise程序进行程序管理监控
- 互联网广告的盈利模式
- linux 的进程调度原理
- Python3的变化
- ubuntu14.04 下 mysql 存储目录迁移