by Waynes Software (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Intermediate
Date Added: Wed 3rd February 2021
Rating: (4 Votes)
Converts a long address (2220112843) to it's IP address (203.59.84.132)
Code Returns
Example:
Result = IPToString(2220112843#)
API DeclarationsType MyLong
Value As Long
End Type
Type MyIP
A As Byte
B As Byte
C As Byte
D As Byte
End Type
Function IPToString(Value As Double) As String
Dim l As MyLong
Dim i As MyIP
l.Value = DoubleToLong(Value)
LSet i = l
IPToString = i.A & "." & i.B & "." & i.C & "." & i.D
End Function
Function DoubleToLong(Value As Double) As Long
If Value <= 2147483647 Then
DoubleToLong = Value
Else
DoubleToLong = -(4294967296# - Value)
End If
End Function