Write contents of std::string to a file. * @return true on success. */
| 390 | * @return true on success. |
| 391 | */ |
| 392 | static bool WriteBinaryFile(const fs::path &filename, const std::string &data) |
| 393 | { |
| 394 | FILE *f = fsbridge::fopen(filename, "wb"); |
| 395 | if (f == nullptr) |
| 396 | return false; |
| 397 | if (fwrite(data.data(), 1, data.size(), f) != data.size()) { |
| 398 | fclose(f); |
| 399 | return false; |
| 400 | } |
| 401 | fclose(f); |
| 402 | return true; |
| 403 | } |
| 404 | |
| 405 | /****** Bitcoin specific TorController implementation ********/ |
| 406 |
no test coverage detected