## File::WriteAllText method


创建新文本文件或覆盖已有文件，并使用指定的编码将指定字符串的内容写入文件。

```cpp
static void System::IO::File::WriteAllText(const String &path, const String &contents, const EncodingPtr &encoding=Text::Encoding::get_UTF8Unmarked())
```


| Parameter | Type | 描述 |
| --- | --- | --- |
| 路径 | const String\& | 要创建或覆盖的文件 |
| 内容 | const String\& | 字符串数组 |
| encoding | const EncodingPtr\& | 要使用的字符编码 |

## 另见

* Class [String](../../../system/string/)
* Typedef [EncodingPtr](../../../system/encodingptr/)
* Class [File](../)
* Namespace [System::IO](../../)
* Library [Aspose.Page for C++](../../../)
