比较两个文件

  • 来源: 互联网 作者: 若水   2008-03-17/16:45
  • Function CompFile(F1asstring,F2asstring) as boolean
    Dim issame as boolean
    Open F1 For Binary  As #1
    Open F2 For Binary As #2

    issame=True
    If LOF(1)<>LOF(2) Then
    issame=False
    Else
    whole&=LOF(1)\10000'numberofwhole10,000bytechunks
    part&=LOF(1)Mod10000'remainingbytesatendoffile
    buffer1$=String$(10000,0)
    buffer2$=String$(10000,0)
    start&=1
    For x&=1 To whole&'thisfor-nextloopwillget10,000
    Get #1,start&,buffer1$'bytechunksatatime.
    Get #2,start&,buffer2$
    If buffer1$<>buffer2$ Then
    issame=False
    Exit For
    End If
    start&=start&+10000
    Next
    buffer1$=String$(part&,0)
    buffer2$=String$(part&,0)
    Get #1,start&,buffer1$'gettheremainingbytesattheend
    Get #2,start&,buffer2$'gettheremainingbytesattheend
    If buffer1$<>buffer2$ Then
    issame=False
    End If
    Close
    CompFile=issame
    End Function


    评论 {{userinfo.comments}}

    {{money}}

    {{question.question}}

    A {{question.A}}
    B {{question.B}}
    C {{question.C}}
    D {{question.D}}
    提交

    驱动号 更多