MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / WriteBinaryFile

Function WriteBinaryFile

src/util/readwritefile.cpp:36–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 6

add_onion_cbMethod · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
BOOST_AUTO_TEST_CASEFunction · 0.85
banman.cppFile · 0.85

Calls 3

fopenFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45

Tested by 3

BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68
BOOST_AUTO_TEST_CASEFunction · 0.68