Fixed the following issues in XCEngine Core module documentation: - Added 'using namespace XCEngine::Core;' to all code examples that use Core types (Event, FileWriter, etc.) without full namespace qualification - Added missing '#include <XCEngine/Containers/String.h>' to FileWriter examples that use Containers::String - Added '#include <string>' to Flush.md example using std::to_string Affected files: - core/core.md: Added using directive and Containers include - event/*.md: Added using namespace to all 8 event doc files - filewriter/*.md: Added using namespace and proper includes to all 6 files
689 B
689 B
FileWriter::Close
void Close();
关闭文件。
描述
关闭当前打开的文件。如果文件未打开,则什么都不做。析构函数会自动调用此方法。
复杂度: O(1)
示例:
#include <XCEngine/Core/FileWriter.h>
using namespace XCEngine::Core;
FileWriter writer;
if (writer.Open("data.txt")) {
writer.Write("Some data\n");
writer.Flush();
writer.Close();
}
// 文件已关闭,可再次打开其他文件
if (writer.Open("other.txt")) {
writer.Write("New content\n");
}
// 析构时自动关闭
相关文档
- FileWriter 总览 - 返回类总览
- Open - 打开文件