MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/SPlisHSPlasH / writeMD5File

Method writeMD5File

Utilities/FileSystem.h:329–343  ·  view source on GitHub ↗

Write the MD5 hash of a file to the md5File. */

Source from the content-addressed store, hash-verified

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 */

Callers

nothing calls this directly

Calls 6

failMethod · 0.80
openMethod · 0.45
c_strMethod · 0.45
writeMethod · 0.45
sizeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected