Files
XCSDD/docs/api/core/filewriter/IsOpen.md
ssdfasd 58a83f445a 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
2026-03-19 12:44:08 +08:00

716 B

FileWriter::IsOpen

bool IsOpen() const;

检查文件是否已打开。

描述

返回文件是否已成功打开并可用于写入。

返回: bool - 文件是否已打开

复杂度: O(1)

示例:

#include <XCEngine/Core/FileWriter.h>

using namespace XCEngine::Core;

FileWriter writer1;
if (writer1.IsOpen()) {
    // 不会执行
    writer1.Write("test");
}

// 打开文件
FileWriter writer2("output.txt");
if (writer2.IsOpen()) {
    printf("File opened successfully\n");
    writer2.Write("Content");
} else {
    printf("Failed to open file\n");
}

相关文档