Create and/or Write to a file

前端 未结 5 1049
逝去的感伤
逝去的感伤 2021-02-07 01:26

I feel like this should be easy, but google is totally failing me at the moment. I want to open a file, or create it if it doesn\'t exist, and write to it.

The followin

5条回答
  •  后悔当初
    2021-02-07 02:07

    If you are just doing something simple, the IOUtils Unit is a lot easier. It has a lot of utilities for writing to files.

    e.g.

    procedure WriteAllText(const Path: string; const Contents: string); overload; static;

    Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.

提交回复
热议问题