LoginSignup
5
5

More than 5 years have passed since last update.

Delphi テキストファイルに追加書き込みする。

Last updated at Posted at 2014-10-30

とりあえずテキストに吐きだしたい時に使う。

既存のファイルに上書き。

var
  txtFile: TextFile;
  str, path: string;
begin
  str := Format('%s %s', ['hoge', 'hoge']);
  path := 'D:\hoge.txt';
  AssignFile(txtFile, path);
  if FileExists(path) then begin
    Append(txtFile);
  end else begin
    Rewrite(txtFile);
  end;
  Writeln(txtFile, str);
  CloseFile(txtFile);
end;

5
5
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
5
5