VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Convert long address to IP address

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 Declarations
Type MyLong
Value As Long
End Type
Type MyIP
A As Byte
B As Byte
C As Byte
D As Byte
End Type

Rate Convert long address to IP address

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

Download this snippet    Add to My Saved Code

Convert long address to IP address Comments

No comments have been posted about Convert long address to IP address. Why not be the first to post a comment about Convert long address to IP address.

Post your comment

Subject:
Message:
0/1000 characters