System.IOUtils.TFile.WriteAllText

提供: RAD Studio API Documentation
移動先: 案内検索

Delphi

class procedure WriteAllText(const Path, Contents: string); overload; static;
class procedure WriteAllText(const Path, Contents: string;  const Encoding: TEncoding); overload; static;

C++

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

プロパティ

種類 可視性 ソース ユニット
procedure
function
public
System.IOUtils.pas
System.IOUtils.hpp
System.IOUtils TFile

説明

指定のテキストをファイルに書き込みます。

指定のテキストをファイルに書き込むには、WriteAllText を使用します。Path パラメータで指定したファイルが存在する場合は、そのファイルが上書きされます。存在しない場合は、ファイルが作成されて、指定のテキストが格納されます。このメソッドに必要なパラメータの一覧を以下の表に示します。



名前 意味

Path

ファイルのパス。

Contents

書き込むテキストを含む文字列。

Encoding

テキストに使用するエンコーディング。



メモ:  ファイルにアクセスできない場合やパスが無効な場合、WriteAllText は例外を発生させます。

関連項目