文本型字符:68797F7100000000private Declare Function SystemInitialization Lib "MakeCard.dll" (ByRef password As Integer) As IntegerDim buf(7) As Integer                                   '保存客户参数缓冲区call SystemInitialization(buf(0))
怎么把上面的文本型字符转换为BUF的数组我这段的文本的由来是
private Declare Function ReadSystemPas Lib "MakeCard.dll" (ByRef password As Integer) As Integer
call ReadSystemPas(buf(0))str=cdata(buf) '就得出上面那段字符了Public Function CData(B() As Integer) As String
Dim Str As String
Dim I As Integer
Str = ""
For I = 0 To 7
    If Len(Hex(B(I))) = 2 Then
        Str = Str + Hex(B(I))
    Else
        Str = Str + "0" + Hex(B(I))
    End If
Next I
CData = Str
End Function我不想每次运行软件都读取一次数据到BUF数组中
我想把文本字符设定到程序中,只须使用SystemInitialization(buf(0))就行了

解决方案 »

  1.   

    晕,不会吧,简单的说就是怎么写出以下的相反函数啊这函数不是数组转文本类型嘛,就是怎么反过来啊
    Public Function CData(B() As Integer) As String
    Dim Str As String
    Dim I As Integer
    Str = ""
    For I = 0 To 7
        If Len(Hex(B(I))) = 2 Then
            Str = Str + Hex(B(I))
        Else
            Str = Str + "0" + Hex(B(I))
        End If
    Next I
    CData = Str
    End Function
      

  2.   

    不知道以下代码能否满足你的需要:Option ExplicitPublic Sub CData2(S As String, b() As Integer)
        Dim i As Integer
        For i = 0 To 7
            b(i) = CInt("&H" & Mid(S, i * 2 + 1, 2))
        Next i
    End SubPrivate Sub Form_Load()
        Dim b(7) As Integer, i As Integer
        CData2 "68797F7100000000", b
        For i = 0 To 7
            Debug.Print b(i)
        Next i
    End Sub