|
|
|
Click here to copy the following block |
Function CompareFiles(ByVal file1 As String, ByVal file2 As String) As Boolean Dim fnum1 As Integer, isOpen1 As Boolean Dim fnum2 As Integer, isopen2 As Boolean Dim buffer1 As String, buffer2 As String Dim bytesLeft As Long Const BUFFERSIZE = 10240 buffer1 = Space$(BUFFERSIZE) buffer2 = buffer1 On Error GoTo ExitProc bytesLeft = FileLen(file1) If bytesLeft <> FileLen(file2) Then Exit Function fnum1 = FreeFile Open file1 For Binary As #fnum1 isOpen1 = True fnum2 = FreeFile Open file2 For Binary As #fnum2 isopen2 = True Do While bytesLeft If bytesLeft < Len(buffer1) Then buffer1 = Space$(bytesLeft) buffer2 = buffer1 End If Get #fnum1, , buffer1 Get #fnum2, , buffer2 If buffer1 <> buffer2 Then Exit Do bytesLeft = bytesLeft - Len(buffer1) Loop CompareFiles = (bytesLeft = 0) ExitProc: If isOpen1 Then Close #fnum1 If isopen2 Then Close #fnum2 If Err Then Err.Raise Err.Number, , Err.Description End If
End Function |
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|