System.IOUtils.TFile.ReadAllText
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 */;
プロパティ
種類 | 可視性 | ソース | ユニット | 親 |
---|---|---|---|---|
function | public | System.IOUtils.pas System.IOUtils.hpp |
System.IOUtils | TFile |
説明
テキスト ファイルの内容を文字列として返します。
テキスト ファイルの内容を読み取るには ReadAllText を使用します。ReadAllText は、ファイルから読み取ったテキスト行を含む文字列を返します。このメソッドに必要なパラメータの一覧を以下の表に示します。
名前 | 意味 |
---|---|
Path |
ファイルのパス。 |
Encoding |
ファイル内に含まれているテキストのエンコーディング。 |
メモ: ファイルを開けない場合やパスが無効な場合、ReadAllText は例外を発生させます。