How to Compare the text in two Text Files
I want to compare the text present two .txt files same or not.
how we can read text from the text file and to compare with other text file.
do we have any command to compare two files. directly.
Thanks in Advance
Re: How to Compare the text in two Text Files
try and use the following example code, NB. you may need to refer to the help to get further assistance
Open "File1" For Input As #1
Open "File2" For Input As #2
While EOF(#1) = False
Input #1, strFile1Line
If EOF(#2) = False Then
Input #2, strFile2Line
strFile2Line = "NO MORE LINES IN FILE2"
If strFile1Line <> strFile2Line Then
UserCheck strFile1Line & " not equal to"
& strFile2Line, False,"Check Name"
UserCheck strFile1Line & " equals "
& strFile2Line, True,"Check Name"
The above example has not been fully tested, but give it a go, may need some tweaking. There is a way to get all the data, using the ReadAll method (refer to VB Language Reference), but this can be a huge burden on system resources, and not recommended.