MCPcopy Create free account
hub / github.com/apache/fory / WriteFile

Function WriteFile

integration_tests/idl_tests/cpp/main.cc:71–84  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71fory::Result<void, fory::Error> WriteFile(const std::string &path,
72 const std::vector<uint8_t> &data) {
73 std::ofstream output(path, std::ios::binary | std::ios::trunc);
74 if (FORY_PREDICT_FALSE(!output)) {
75 return fory::Unexpected(
76 fory::Error::invalid("failed to open data file for writing"));
77 }
78 output.write(reinterpret_cast<const char *>(data.data()),
79 static_cast<std::streamsize>(data.size()));
80 if (FORY_PREDICT_FALSE(!output)) {
81 return fory::Unexpected(fory::Error::invalid("failed to write data file"));
82 }
83 return fory::Result<void, fory::Error>();
84}
85
86template <typename T> std::string VectorDebugString(const std::vector<T> &v) {
87 std::ostringstream out;

Callers 1

RunRoundTripFunction · 0.85

Calls 4

UnexpectedClass · 0.85
writeMethod · 0.65
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected