别人提供了一个接口,要是一个字节数组,现在需要把一个xml文件或者xml格式的字符串写成一个字节数组请问怎么写?

解决方案 »

  1.   

    Private Sub StringToByteArray(ByteArray() As Byte, str As String, lSize As Long)
        Dim i As Long
        Dim S As String
        
        S = str
        For i = 0 To lSize - 1
            If Len(S) <> 0 Then
                ByteArray(i) = Asc(S)
                S = Right(S, Len(S) - 1)
            Else
                ByteArray(i) = 0
            End If
        Next i
    End Sub
      

  2.   

    搂住写的不对吧    If Len(S) <> 0 Then
                ByteArray(i) = Asc(S)我也想知道怎么实现
    直接copymemory做?