System.IOUtils.TFile.WriteAllLines
Delphi
class procedure WriteAllLines(const Path: string; const Contents: TStringDynArray); overload; inline; static;
class procedure WriteAllLines(const Path: string; const Contents: TStringDynArray; const Encoding: TEncoding); overload; static;
C++
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::TStringDynArray Contents)/* overload */;
static void __fastcall WriteAllLines(const System::UnicodeString Path, const System::TStringDynArray Contents, System::Sysutils::TEncoding* const Encoding)/* overload */;
Properties
Type | Visibility | Source | Unit | Parent |
---|---|---|---|---|
procedure function |
public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | TFile |
Description
Writes a given array of strings to a file.
Use WriteAllLines to write a given array of strings to a file. If the file specified by the Path parameter exists, it is overwritten; otherwise the file is created and filled with the given text lines. The following table lists the parameters expected by this method.
Name | Meaning |
---|---|
Path |
The path to the file. |
Contents |
The array of strings containing the text to be written. |
Encoding |
The encoding used for the strings |
Note: WriteAllLines raises an exception if the file cannot be accessed or the path is invalid.