MCPcopy Create free account
hub / github.com/ElementsProject/elements / WriteBinaryFile

Function WriteBinaryFile

src/util/readwritefile.cpp:34–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32}
33
34bool WriteBinaryFile(const fs::path &filename, const std::string &data)
35{
36 FILE *f = fsbridge::fopen(filename, "wb");
37 if (f == nullptr)
38 return false;
39 if (fwrite(data.data(), 1, data.size(), f) != data.size()) {
40 fclose(f);
41 return false;
42 }
43 if (fclose(f) != 0) {
44 return false;
45 }
46 return true;
47}

Callers 4

add_onion_cbMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
FUZZ_TARGET_INITFunction · 0.85

Calls 3

fopenFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.68
FUZZ_TARGET_INITFunction · 0.68