Click to See Complete Forum and Search --> : File comparing


Sodium
October 20th, 1999, 03:45 AM
Hi all,
I want to write a program that able to compares file. It should able to detect if two files, A and B are idential. Input files will be binary or test from,
so I wish the program will compare files byte-by-byte form. Is VB have such function to compare files? Or by coding? How?

Thank

Lothar Haensler
October 20th, 1999, 03:57 AM
AFAIK VB does not have a filecompare function.
But, you can use the WinDiff utility that comes with Visual Studio 6.
There are so many free file comparison utilities out there on the web, that it's hard to find a reason for writing your own.

if I had to do it, I'd read the complete files into two strings and to a byte by byte comparison...

Crazy D @ Work
October 20th, 1999, 05:04 AM
Indeed lots of tools available, but I'd open the file binairy and read byte by byte, and compare them. As soon as they're not identical you can stop the compare (oh, and first, I would compare the filesize in bytes.. if they're not the same you don't need to check at all since they can't be identical then...)
Unless of course you want to compare textfiles in various formats (rich text, word, plain text) and compare the text in the files... if you wanna do that.. good luck :-)

Crazy D @ Work :-)