Winsock [帮忙,Hex和ASCII字符转换]
因为是winsock接收,为什么不能将接收到的ascii弄的跟wpe接收的一样
特殊字符就用点来表示 ....
abcdef....aaaaa......
我自己写的转换函数都转出abcdef 口口aaaaa口.?.
这样的。。
有啥办法啊????

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Destination As Any, ByRef Source As Any, ByVal Length As Long)
程序代码:
#If tools Then
'工具显示16进制代码
With Form1.Text3
Dim txj As String
Dim txj2 As String
Dim txj3 As String
Dim txp As Boolean
Dim txj4 As Integer
Dim txk(1) As Byte
.Text = "加密结果" & vbCrLf & " 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F"
For i = 0 To optr - 1
'.Text =.Text & vbcrlf &
txj = Hex(pout(i))
If Len(txj) = 1 Then txj = "0" & txj
txj2 = txj2 & " " & txj '这是生成16进制部分
If pout(i) < 128 Then '从这里开始是生成 ASCII 部分
If pout(i) >= 32 Then '可显示字符
txj3 = txj3 & Chr(pout(i))
Else
txj3 = txj3 & "."
End If
Else
If Not txp Then '是否上一个字符输出时,取走了这个字符,否,输出中文
txk(1) = pout(i)
txk(0) = pout(i + 1)
CopyMemory txj4, txk(0), 2
txj3 = txj3 & Chr(txj4)
txp = True '设置取走了下一个字符
Else
txp = False
End If
End If
If (i + 1) Mod 16 = 0 Then '换行,按每行16个字节排列
txj = "0" & i \ 16
txj = String(4 - Len(txj), "0") & txj
.Text = .Text & vbCrLf & txj & " " & txj2 & " " & txj3
txj2 = ""
txj3 = ""
End If
Next i
txj = "0" & i \ 16 '最后一行的显示
txj = String(4 - Len(txj), "0") & txj
.Text = .Text & vbCrLf & txj & " " & txj2 & Space(48 - Len(txj2)) & " " & txj3
End With
'工具输出结束
#End If
