File compare

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
 
C

Chris

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
 
C

Cor Ligthert [MVP]

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
 
K

Ken Tucker [MVP]

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
 
K

Ken Tucker [MVP]

Hi,

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

Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top