| 84 | } |
| 85 | |
| 86 | std::vector<uint8_t> read_file(const std::string &path) { |
| 87 | std::ifstream input(path, std::ios::binary); |
| 88 | if (!input) { |
| 89 | fail("Failed to open file for reading: " + path); |
| 90 | } |
| 91 | std::vector<uint8_t> data((std::istreambuf_iterator<char>(input)), |
| 92 | std::istreambuf_iterator<char>()); |
| 93 | maybe_dump_input(data); |
| 94 | return data; |
| 95 | } |
| 96 | |
| 97 | void write_file(const std::string &path, const std::vector<uint8_t> &data) { |
| 98 | std::ofstream output(path, std::ios::binary | std::ios::trunc); |
no test coverage detected