Write the MD5 hash of a file to the md5File. */
| 327 | /** Write the MD5 hash of a file to the md5File. |
| 328 | */ |
| 329 | static bool writeMD5File(const std::string& fileName, const std::string& md5File) |
| 330 | { |
| 331 | std::ofstream fstream; |
| 332 | fstream.open(md5File.c_str(), std::ios::out); |
| 333 | if (fstream.fail()) |
| 334 | { |
| 335 | std::cerr << "Failed to open file: " << md5File << "\n"; |
| 336 | return false; |
| 337 | } |
| 338 | std::string md5 = getFileMD5(fileName); |
| 339 | if (md5 != "") |
| 340 | fstream.write(md5.c_str(), md5.size()); |
| 341 | fstream.close(); |
| 342 | return true; |
| 343 | } |
| 344 | |
| 345 | /** Compare an MD5 hash with the hash stored in an MD5 file. |
| 346 | */ |