6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Delphi: ファイルに保存

Posted at

ごく簡単な説明目的で記載しています。

ファイルに保存

sample.pas
procedure TForm1.Button1Click(Sender: TObject);
var
  MyText: TStringlist;
begin

  MyText:= TStringlist.create;
  try
    MyText.Add('line 1');
    MyText.Add('line 2');
    MyText.SaveToFile('E:\filename.txt');
  finally
    MyText.Free
  end; {try}
end;

procedure TForm1.Button2Click(Sender: TObject);
var
  MyText: TStringlist;
  dt:TDateTime;
begin
  dt:=Now;
  MyText:= TStringlist.create;

  try
    MyText.Add(DateTimeToStr(dt));
    MyText.SaveToFile('E:\filename.txt');
  finally
    MyText.Free
  end; {try}
end;

image.png

参考

以上です。

6
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?