|
-
Aug 17th, 2001, 06:57 AM
#1
Thread Starter
Addicted Member
compare text files
Has anyone written something that can compare two text files and output the differences, or know of freewhere I can download to do this?
-
Aug 17th, 2001, 07:32 AM
#2
Registered User
Here is some code to work with:
VB Code:
Function SameFile(ByVal Path1$, ByVal Path2$) As Boolean
'Nucleus
Dim ba1() As Byte, ba2() As Byte
Dim ff&, i&, u&
On Error Resume Next
If Len(Dir$(Path1)) And Len(Dir$(Path2)) Then
ff = FreeFile
Open Path1 For Binary As #ff
ReDim ba1(0 To LOF(ff) - 1)
Get #ff, , ba1
Close #ff
ff = FreeFile
Open Path2 For Binary As #ff
ReDim ba2(0 To LOF(ff) - 1)
Get #ff, , ba2
Close #ff
u = UBound(ba1)
If u = UBound(ba2) Then
For i = 0 To UBound(ba1)
If ba1(i) <> ba2(i) Then Exit For
Next
If i = u + 1 Then SameFile = True
End If
End If
End Function
-
Aug 17th, 2001, 07:44 AM
#3
PowerPoster
There is actually a DOS command that does this (at least there used to be). Can't remember the name of it though.
-
Aug 17th, 2001, 07:48 AM
#4
PowerPoster
DOS file compare command (still works)
fc filname1 filename2
-
Aug 17th, 2001, 07:48 AM
#5
Thread Starter
Addicted Member
richyrich
Thanks Nuke, found the dos command it is call ed comp
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|