fix: improve doc link navigation and tree display
- Fix link resolution with proper relative/absolute path handling - Improve link styling with underline decoration - Hide leaf nodes from tree, only show directories - Fix log file path for packaged app
This commit is contained in:
53
docs/api/core/filewriter/Open.md
Normal file
53
docs/api/core/filewriter/Open.md
Normal file
@@ -0,0 +1,53 @@
|
||||
# FileWriter::Open
|
||||
|
||||
```cpp
|
||||
bool Open(const char* filePath, bool append = false);
|
||||
```
|
||||
|
||||
打开文件。
|
||||
|
||||
**描述**
|
||||
|
||||
打开指定路径的文件,准备写入。如果之前已打开文件,会先关闭。返回是否成功打开文件。
|
||||
|
||||
**参数:**
|
||||
- `filePath` - 要打开的文件路径
|
||||
- `append` - 是否以追加模式打开,默认为覆盖模式
|
||||
|
||||
**返回:** `bool` - 是否成功打开
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include <XCEngine/Core/FileWriter.h>
|
||||
|
||||
using namespace XCEngine::Core;
|
||||
|
||||
FileWriter writer;
|
||||
|
||||
// 打开文件(覆盖模式)
|
||||
if (writer.Open("output.txt")) {
|
||||
writer.Write("Hello\n");
|
||||
writer.Close();
|
||||
}
|
||||
|
||||
// 打开文件(追加模式)
|
||||
if (writer.Open("log.txt", true)) {
|
||||
writer.Write("Another line\n");
|
||||
writer.Flush();
|
||||
}
|
||||
|
||||
// 检查是否成功
|
||||
FileWriter writer2;
|
||||
if (!writer2.Open("/invalid/path/file.txt")) {
|
||||
printf("Failed to open file\n");
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [FileWriter 总览](filewriter.md) - 返回类总览
|
||||
- [Close](Close.md) - 关闭文件
|
||||
- [IsOpen](IsOpen.md) - 检查文件状态
|
||||
Reference in New Issue
Block a user