AHOI智能评测系统开发(三)

前段时间困扰我的.out文件问题已经得到解决,有两种解决方案。
一、简单的方法将源文件编译生成的Ahoi.exe文件放在与考生编的problem.exe和测试的problem.in放在同一目录下即可,但是实际开发时没法用。
二、实际采用的方法思想是“改变当前目录”,短短的一两行代码就可以达到效果:
ChDrive "e:" '改变当前程序的盘符
ChDrive strExamineeProgramsPath+strSingleTestDirectoy
'这里用两个string变量来表示我想更改的路径,实际程序中strExamineeProgramsPath赋的值 '是"E:/AHOI/ExamineePrograms",strSingleTestDirectoy每次都会变化,比如 '050101,050213等。。
聪明的你一定知道为什么了吧,呵呵~~

昨天找到一个非常好的(不是一般的好)VB学习网站,分享一下: http://www.applevb.com/index.html
从其中偶得一段关于文件比较的代码,放出来:
Function CompFile(F1 As String, F2 As String) 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 'number of whole 10,000 byte chunks
        part& = LOF(1) Mod 10000 'remaining bytes at end of file
        buffer1$ = String$(10000, 0)
        buffer2$ = String$(10000, 0)
        start& = 1
        For X& = 1 To whole& 'this for-next loop will get 10,000
            Get #1, start&, buffer1$ 'byte chunks at a time.
            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$ 'get the remaining bytes at the end
        Get #2, start&, buffer2$ 'get the remaining bytes at the end
       
        If buffer1$ <> buffer2$ Then
            issame = False
        End If
    End If
        Close
        CompFile = issame
End Function

下一步的工作是寻找生成临时文件的方法,以及多点测试的连贯性,准确性问题。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值