| 193 | } |
| 194 | |
| 195 | bool load_file(std::vector<patch_byte> *pvec, std::string fname) |
| 196 | { |
| 197 | FILE *f = fopen(fname.c_str(), "rb"); |
| 198 | if (!f) |
| 199 | { |
| 200 | cerr << "Cannot open file: " << fname << endl; |
| 201 | return false; |
| 202 | } |
| 203 | |
| 204 | fseek(f, 0, SEEK_END); |
| 205 | pvec->resize(ftell(f)); |
| 206 | fseek(f, 0, SEEK_SET); |
| 207 | size_t cnt = fread(pvec->data(), 1, pvec->size(), f); |
| 208 | fclose(f); |
| 209 | |
| 210 | return cnt == pvec->size(); |
| 211 | } |
| 212 | |
| 213 | bool save_file(const std::vector<patch_byte> &pvec, std::string fname) |
| 214 | { |