主题:缺少数组,请求帮助
Public Function ResolveHostname(ByVal ipaddress As String) As String
Dim hostip_addr As Long
Dim hostent_addr As Long
Dim newAddr As Long
Dim host As HostEnt
Dim strTemp As String
'
Dim strHost As String * 255
If (SocketsInitialize()) Then
Let newAddr = inet_addr(ipaddress)
Let hostent_addr = gethostbyaddr(newAddr, Len(newAddr), AF_INET)
If (hostent_addr = 0) Then
Call SocketsCleanup
Exit Function
End If
Call RtlMoveMemory(host, hostent_addr, Len(host))
Call RtlMoveMemory(ByVal strHost, host.hName, 255)
Let strTemp = strHost
If InStr(strTemp, Chr(0)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
Let strTemp = Trim(strTemp)
Let ResolveHostname = strTemp
Call SocketsCleanup
End If
End Function
这行出错:
If InStr(strTemp, Chr(0)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
Dim hostip_addr As Long
Dim hostent_addr As Long
Dim newAddr As Long
Dim host As HostEnt
Dim strTemp As String
'
Dim strHost As String * 255
If (SocketsInitialize()) Then
Let newAddr = inet_addr(ipaddress)
Let hostent_addr = gethostbyaddr(newAddr, Len(newAddr), AF_INET)
If (hostent_addr = 0) Then
Call SocketsCleanup
Exit Function
End If
Call RtlMoveMemory(host, hostent_addr, Len(host))
Call RtlMoveMemory(ByVal strHost, host.hName, 255)
Let strTemp = strHost
If InStr(strTemp, Chr(0)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)
Let strTemp = Trim(strTemp)
Let ResolveHostname = strTemp
Call SocketsCleanup
End If
End Function
这行出错:
If InStr(strTemp, Chr(0)) <> 0 Then strTemp = Left(strTemp, InStr(strTemp, Chr(0)) - 1)