delphi TFile写入文本

//需要引用System.IOUtils单元
procedure
TForm7.Button3Click(Sender: TObject); var sFileName: string; tstream: TStreamWriter; begin Memo1.Clear; Memo1.Lines.Add(TPath.GetFileName(Application.ExeName)); Memo1.Lines.Add(TPath.GetDownloadsPath); Memo1.Lines.Add(TPath.GetHomePath); sFileName := TDirectory.GetCurrentDirectory + '\' + '33333.txt'; if TFile.Exists(sFileName) then TFile.Delete(sFileName); tstream := TFile.CreateText(sFileName); try tstream.WriteLine('33333333333'); tstream.WriteLine('GBK中文显示不知道有没有问题!'); finally tstream.Free; end; end;

 

posted @ 2019-02-27 11:19  夏天的西瓜君  阅读(1030)  评论(0编辑  收藏  举报