| 69 | } |
| 70 | |
| 71 | static std::string read_file(const std::string & fname) { |
| 72 | std::ifstream file(fname); |
| 73 | if (!file) { |
| 74 | throw std::runtime_error(string_format("error: failed to open file '%s'\n", fname.c_str())); |
| 75 | } |
| 76 | std::string content((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>()); |
| 77 | file.close(); |
| 78 | return content; |
| 79 | } |
| 80 | |
| 81 | static void write_file(const std::string & fname, const std::string & content) { |
| 82 | const std::string fname_tmp = fname + ".tmp"; |
no test coverage detected