如何将一个二进制的可执行文件,拆分为一个一个文件包,比如一个包200字节,发送到客户端, 客户端收到后再将所有包组合起来,生成原有的文件? 急啊,在线等待ing...

解决方案 »

  1.   

    option base 0
    sub SendFile(byval FileName as string)
        dim hFile as integer, a() as byte, lLength as long
        redim a(200-1)
        hFile = FreeFile()
        Open FileName for binary access read as #hFile
        lLength = LOF(hFile)
        while lLength > 0
            if lLength < 200 then redim a(lLength-1)
            Get #hFile, , a
            发送a
            lLength = lLength-200
        wend
        Close #hFile
    end subsub ReciveFile(byval FileName as string)
        dim hFile as integer, a() as byte
        hFile = FreeFile()
        Open FileName for binary access write as #hFile
        while 读取(a)
            Put #hFile, , a
        wend
        Close #hFile
    end sub
      

  2.   

    没那么想得复杂,其实就是文件传输。参考代码:http://www.newasp.net/code/vb/152.html
      

  3.   

    Tiger_Zhao 
    VB老鸟 
    等 级:
    =================最后请问一下,如何将字符串,直接转换成字符数组.比如一个字符串"C1~C1010101"直接变换成字符数组数据.
      

  4.   

    '如果你指的是Ansi格式的字节数组,如下
    dim a() as byte 
    a = strconv("C1~C1010101", vbfromunicode)'反过来
    dim s as string 
    s = strconv(a, vbunicode)