| 5 | {; |
| 6 | |
| 7 | bool LoadFile(const std::string& strFilename, std::vector<uint8_t>& vtData) |
| 8 | { |
| 9 | bool bRet = false; |
| 10 | do |
| 11 | { |
| 12 | if (strFilename.empty()) |
| 13 | { |
| 14 | break; |
| 15 | } |
| 16 | |
| 17 | std::ifstream fin(strFilename, std::ifstream::in | std::ifstream::ate | std::ifstream::binary); |
| 18 | if (!fin.is_open()) |
| 19 | { |
| 20 | break; |
| 21 | } |
| 22 | |
| 23 | size_t nFileSize = (size_t)fin.tellg(); |
| 24 | vtData.resize(nFileSize); |
| 25 | |
| 26 | fin.seekg(0); |
| 27 | fin.read((char*)vtData.data(), nFileSize); |
| 28 | |
| 29 | fin.close(); |
| 30 | |
| 31 | bRet = true; |
| 32 | } while (false); |
| 33 | return bRet; |
| 34 | } |
| 35 | |
| 36 | std::vector<uint8_t> LoadFile(const std::string& strFilename) |
| 37 | { |