操作二进制流,必然面对字串化为16进制码的问题

此函数作用如此

function str2bytes(str)
   
for i=1 to lenb(str)
      temp
=temp&midb(str,i,1)
      i
=i+1
   
next
   str2bytes
=temp
end function

将16进制内码转为字符串函数

Function bytes2BSTR(vIn)

    
Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,NextCharCode
    strReturn 
= ""
    
    
For i = 1 To LenB(vIn)
        ThisCharCode 
= AscB(MidB(vIn,i,1))
        
If ThisCharCode < &H80 Then
            strReturn 
= strReturn & Chr(ThisCharCode)
        
Else
            NextCharCode 
= AscB(MidB(vIn,i+1,1))
            strReturn 
= strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
            i 
= i + 1
        
End If
    
Next
    
    bytes2BSTR 
= strReturn
    
End Function

前面一个函数我写的,后面是孟子E章写的

http://search.csdn.net/Expert/topic/749/749555.xml?temp=.3940393

Posted on 2005-03-25 23:15  古代  阅读(689)  评论(0)    收藏  举报