如何在Delphi中创建文本文件 [英] How would I create a text file in Delphi

查看:113
本文介绍了如何在Delphi中创建文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,用户可以在其中注册我的程序,并为他们创建一个文本文件.我尝试使用CreateFile函数,但不确定参数.当每个用户使用此功能或其他任何功能注册时,如何为每个用户创建文本文件?

I have a program where users register for my program and a text file is created for them. I have tried using the CreateFile function but am not sure on the parameters. How would I create a textfile for each user as they register using this, or any other function?

推荐答案

也许您可以创建一个字符串列表并将其保存到文件中:

Maybe you can create a stringlist and save that to file:

procedure MakeAStringlistAndSaveThat;
var
  MyText: TStringlist;
begin
  MyText:= TStringlist.create;
  try
    MyText.Add('line 1');
    MyText.Add('line 2');
    MyText.SaveToFile('c:\folder\filename.txt');
  finally
    MyText.Free
  end; {try}
end;

这篇关于如何在Delphi中创建文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆