System.IOUtils.TFile.ReadAllText

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

class function ReadAllText(const Path: string): string; overload; inline; static;
class function ReadAllText(const Path: string;  const Encoding: TEncoding): string; overload; inline; static;

C++

static System::UnicodeString __fastcall ReadAllText(const System::UnicodeString Path)/* overload */;
static System::UnicodeString __fastcall ReadAllText(const System::UnicodeString Path, System::Sysutils::TEncoding* const Encoding)/* overload */;

Properties

Type Visibility Source Unit Parent
function public
System.IOUtils.pas
System.IOUtils.hpp
System.IOUtils TFile

Description

Returns the contents of a textual file as a string.

Use ReadAllText to read the contents of a textual file. ReadAllText returns a string containing the text read from the file. The following table lists the parameters expected by this method.



Name Meaning

Path

The path to the file.

Encoding

The encoding of the text contained within the file.



Note: ReadAllText raises an exception if the file cannot be opened or the path is invalid.

See Also

Code Examples