MCPcopy Create free account
hub / github.com/DFHack/dfhack / save_file

Function save_file

library/binpatch.cpp:213–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211}
212
213bool save_file(const std::vector<patch_byte> &pvec, std::string fname)
214{
215 FILE *f = fopen(fname.c_str(), "wb");
216 if (!f)
217 {
218 cerr << "Cannot open file: " << fname << endl;
219 return false;
220 }
221
222 size_t cnt = fwrite(pvec.data(), 1, pvec.size(), f);
223 fclose(f);
224
225 return cnt == pvec.size();
226}
227
228std::string compute_hash(const std::vector<patch_byte> &pvec)
229{

Callers 1

mainFunction · 0.70

Calls 3

c_strMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected