File compare

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

What is the simplest way to determine if two files are identical (that is,
all bytes the same).
I want to check to see it the current version of a .jpg file is identical to
the original.
I wish to ignore any bytes that indicate file attributes (read only, date
last accessed etc.)
I just need to confirm the contents are unchanged.
thanx.....joisey
 
What is the simplest way to determine if two files are identical (that is,
all bytes the same).
I want to check to see it the current version of a .jpg file is identical to
the original.
I wish to ignore any bytes that indicate file attributes (read only, date
last accessed etc.)
I just need to confirm the contents are unchanged.
thanx.....joisey

Just open each file as a stream, read in each byte and compare them. As
soon as you find a byte that isn't equal, you know the files aren't the
same.

Chris
 
Joisey,

In addition to Chris,

Before you start comparing them you can see if the lenght is the same, if
not than you are sure they are not the same.

I hope this helps,

Cor
 
Hi,

This article shows how to check the hash of a file to see if it
is the same

http://msdn.microsoft.com/msdnmag/issues/03/05/VirusHunting/default.aspx

link to code window
http://msdn.microsoft.com/msdnmag/issues/03/05/VirusHunting/default.aspx?fig=true#fig5

Ken
------------------
What is the simplest way to determine if two files are identical (that is,
all bytes the same).
I want to check to see it the current version of a .jpg file is identical to
the original.
I wish to ignore any bytes that indicate file attributes (read only, date
last accessed etc.)
I just need to confirm the contents are unchanged.
thanx.....joisey
 
Hi,

The article was dealing with preventing someone from altering
your exe. The hash will work with anytype file.

Ken
 
Back
Top