* Add the content of the given filename to the resources. * @param filename File to add to the resources. */
| 36 | * @param filename File to add to the resources. |
| 37 | */ |
| 38 | void dumpFile(const std::string& filename) |
| 39 | { |
| 40 | using namespace std; |
| 41 | |
| 42 | ifstream f(filename.c_str(), ios::binary); |
| 43 | |
| 44 | unsigned char buffer[1024]; |
| 45 | |
| 46 | while(!f.eof()) |
| 47 | { |
| 48 | f.read(reinterpret_cast<char *>(buffer), sizeof(buffer)); |
| 49 | size_t n = f.gcount(); |
| 50 | |
| 51 | if(n == 0) break; |
| 52 | |
| 53 | cout << hex << setw(2) << setfill('0') << " "; |
| 54 | for(size_t i = 0; i < n; ++i) |
| 55 | { |
| 56 | cout << "0x" << int(buffer[i]) << ", "; |
| 57 | } |
| 58 | cout << endl; |
| 59 | } |
| 60 | cout << dec; |
| 61 | } |
| 62 | |
| 63 | /** |
| 64 | * Main application entry point. |