Predmet:usporedi dva fajla
   
Ova funkcija će usporediti jednu datoteke sa drugom. Moze usporediti samo duzinu datoteka ili razliku datoteka byte po byte.
Pozivate je:
usporediDatoteke(File1,File2) - samo za usporediti duzinu datoteka
usporediDatoteku(File1,File2,True) - usporeduje byte po byte datoteka
gdje su File1=App.Path & "/ime1.ext" i File2=App.Path & "/ime2.ext"
PreuzmiIzvorni kôd (Visual Basic):- Function usporediDatoteke(ByVal File1 As String, _ 
-   ByVal File2 As String, Optional StringentCheck As _ 
-   Boolean = False) As Boolean 
- '******************************************************************************************* 
- 'Ime: usporediDatoteke 
- 'Namjena: Provjeri dali su dvije datoteke identicne 
- 'Autor: Ervin Kosch 
- 'Ulazni parametri: 
- '     -File1 i File2  = putanje sa imenom datoteke 
- '     -StringentCheck = if false (default), usporeduje samo duzinu 
- '     -StringentCheck = if true , usporeduje byte po byte datoteke 
- 'Izlazni parametri: Boolean 
- '******************************************************************************************** 
-   
- On Error GoTo ErrorHandler 
-   
- If Dir(File1) = "" Then Exit Function 
- If Dir(File2) = "" Then Exit Function 
-   
- Dim lLen1 As Long, lLen2 As Long 
- Dim iFileNum1 As Integer 
- Dim iFileNum2 As Integer 
- Dim bytArr1() As Byte, bytArr2() As Byte 
- Dim lCtr As Long, lStart As Long 
- Dim bAns As Boolean 
-   
- lLen1 = FileLen(File1) 
- lLen2 = FileLen(File2) 
- If lLen1 <> lLen2 Then 
-     Exit Function 
- ElseIf StringentCheck = False Then 
-         usporediDatoteke = True 
-         Exit Function 
- Else 
-     iFileNum1 = FreeFile 
-     Open File1 For Binary Access Read As #iFileNum1 
-     iFileNum2 = FreeFile 
-     Open File2 For Binary Access Read As #iFileNum2 
-   
-     'put contents of both into byte Array 
-     bytArr1() = InputB(LOF(iFileNum1), #iFileNum1) 
-     bytArr2() = InputB(LOF(iFileNum2), #iFileNum2) 
-     lLen1 = UBound(bytArr1) 
-     lStart = LBound(bytArr1) 
-      
-     bAns = True 
-     For lCtr = lStart To lLen1 
-         If bytArr1(lCtr) <> bytArr2(lCtr) Then 
-             bAns = False 
-             Exit For 
-         End If 
-              
-     Next 
-     usporediDatoteke = bAns 
-         
- End If 
-   
- ErrorHandler: 
- If iFileNum1 > 0 Then Close #iFileNum1 
- If iFileNum2 > 0 Then Close #iFileNum2 
- End Function 
    
     zivot je moja domovina.