[Solved] Binary file compare
-
Hi everybody,
I have a small question, i need to compare two binary files and i want to compare if they are equal or not, i thought to check some properties like file size, but, What you recommend to compare if the content is equal??
Any suggestion??
Thanks!
Avmg -
Hi,
How about checking the md5 ?
-
AFAIK, md5 can be generated for any file.
bq. I want to read these binary files from a logger but i didn’t see anything about md5, How can i get this information?
Using Qt APIs you can do following:
@
QCryptographicHash md5gen(QCryptographicHash::Md5);
QFile file("myFile.pdf");
file.open(QIODevice::ReadOnly);
md5gen.addData(file.readAll());
file.close();
qDebug() << md5gen.result().toHex();
@Here md5 is calculated for a PDF file. Similarly it will work for other files too.
-
You're Welcome :) Happy Coding