469,362 Members | 2,361 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,362 developers. It's quick & easy.

File compare

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
Nov 21 '05 #1
5 1441
jo****@mindspring.com wrote:
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
Nov 21 '05 #2
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
Nov 21 '05 #3
Hi,

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

http://msdn.microsoft.com/msdnmag/is...g/default.aspx

link to code window
http://msdn.microsoft.com/msdnmag/is...?fig=true#fig5

Ken
------------------
<jo****@mindspring.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #4
thanx
these deal with executable files. I wll only be dealing with data files
joisey

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Hi,

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

http://msdn.microsoft.com/msdnmag/is...g/default.aspx

link to code window
http://msdn.microsoft.com/msdnmag/is...?fig=true#fig5

Ken
------------------
<jo****@mindspring.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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

Nov 21 '05 #5
Hi,

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

Ken
--------------------
<jo****@mindspring.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
thanx
these deal with executable files. I wll only be dealing with data files
joisey

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
Hi,

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

http://msdn.microsoft.com/msdnmag/is...g/default.aspx

link to code window
http://msdn.microsoft.com/msdnmag/is...?fig=true#fig5

Ken
------------------
<jo****@mindspring.com> wrote in message
news:Ov**************@tk2msftngp13.phx.gbl...
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


Nov 21 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by RitaG | last post: by
46 posts views Thread by dawn | last post: by
reply views Thread by Sunit Joshi | last post: by
18 posts views Thread by Torben Laursen | last post: by
1 post views Thread by Roy | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.