| 50 | } |
| 51 | |
| 52 | bool ReadFile(const std::string& filename, std::vector<uint8_t>& bin) |
| 53 | { |
| 54 | std::ifstream infile(filename, std::ios::in | std::ios::binary | std::ios::ate); |
| 55 | if (!infile) |
| 56 | { |
| 57 | std::cerr << "Error: Could not open file for reading: " + filename << std::endl; |
| 58 | return false; |
| 59 | } |
| 60 | |
| 61 | std::streamsize size = infile.tellg(); |
| 62 | infile.seekg(0, std::ios::beg); |
| 63 | |
| 64 | bin.resize(size); |
| 65 | infile.read(reinterpret_cast<char*>(bin.data()), size); |
| 66 | infile.close(); |
| 67 | return true; |
| 68 | } |
| 69 | |
| 70 | int main(int argc, char* argv[]) |
| 71 | { |