MCPcopy Create free account
hub / github.com/Tencent/libpag / WriteTextFile

Function WriteTextFile

exporter/src/utils/FileHelper.cpp:43–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41}
42
43size_t WriteTextFile(const std::string& fileName, const char* text) {
44 auto path = Utf8ToPath(fileName);
45 auto parentPath = path.parent_path();
46 if (!parentPath.empty() && !fs::exists(parentPath)) {
47 fs::create_directories(parentPath);
48 }
49 std::ofstream file(path, std::ios::out);
50 if (!file.is_open()) {
51 return 0;
52 }
53 file << text;
54 auto size = static_cast<size_t>(file.tellp());
55 file.close();
56 return size;
57}
58
59size_t WriteTextFile(const std::string& fileName, const std::string& text) {
60 return WriteTextFile(fileName, text.c_str());

Callers 3

openMethod · 0.85
writeEndParamMethod · 0.85
writeFrameInfoMethod · 0.85

Calls 3

emptyMethod · 0.80
Utf8ToPathFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected