Results 1 to 1 of 1
2001-08-01, 14:28 #1
- Join Date
- Feb 2001
- Yilgarn region of Toronto, Ontario
- Thanked 0 Times in 0 Posts
While Loc(intOne) < LOF(intOne) (word97SR2/Win95Collector's edition)
The crude routine below susprises me.
It doesn't appear to fail with the LOC/LOF test, and it doesn't fail when only part of a 10,000 chunk is read.
I don't mind, really. I am using it to compare files of MP3 types (hence the larg buffer size), and it works fine with buffer lengths of 1 and 10 and 100 on various tests with my Autoexec files.
That is, I am satisfied that it is detecting errors at all the right places.
I had thought that I would have to write a "now compare the remaining characters in the partial block" code.
I'm also seeking comments on the InputB function.
Private Const intcLength As Integer = 10000
' Compare two files, bit-for-bit
Dim strFileOne As String
Dim intOne As Integer
Dim strFileTwo As String
Dim intTwo As Integer
strFileOne = "c:autoexec.bat"
strFileTwo = "c:autoexec.bak"
' Open files
intOne = FreeFile
Open strFileOne For Binary As intOne
intTwo = FreeFile
Open strFileTwo For Binary As intTwo
' If length different then files are different
If LOF(intOne) <> LOF(intTwo) Then
MsgBox "fles are of different length"
Do While Loc(intOne) < LOF(intOne) ' Loop until end of file.
If Input(intcLength, #intOne) <> Input(intcLength, intTwo) Then
MsgBox "different text at " & Loc(intOne)
Application.StatusBar = LOF(intOne) & " " & Loc(intOne)