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 the given Contents
string array to the Path
text file.
WriteAllText, with one parameter, first creates the Path
file, then retrieves the string from the the specified Contents
string array and encodes this string using the UTF8 encoding, and then writes the encoded string into the created text file.
WriteAllText, with two parameters, first creates the Path
file, then writes the preamble describing the specified Encoding
encoding into the created file, then retrieves the string from the the specified Contents
string array and encodes this string using the specified Encoding
encoding, and then appends the encoded string to the text 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.
WriteAllLines has the following parameters:
Path
is the path to the file.Contents
is the array of strings containing the text to be written.Encoding
is the encoding to be used for the text.