`
Par2: Storing an IP Address in a file 1998-08-04 -- Sean Wilson > I am writing a program to keep track of all my IP Address. I have yet to > find a way to get them > to list ascending when I go to look them up. An IP address is just the 4 bytes of a LONG, one way to do what you want may to create the LONG: IP GROUP Addr GROUP B1 BYTE B2 BYTE B3 BYTE B4 BYTE END Num LONG, OVER(Addr) END IPAddress STRING(16) dot# = INSTRING('.',IPAddress,1) IF dot# THEN IP:Addr:B1 = IPAddress[1 : dot#-1] END start# = dot#+1 dot# = INSTRING('.',IPAddress,1,start#) IF dot# THEN IP:Addr:B2 = IPAddress[start# : dot#-1] END start# = dot#+1 dot# = INSTRING('.',IPAddress,1,start#) IF dot# THEN IP:Addr:B3 = IPAddress[start# : dot#-1] END start# = dot#+1 dot# = INSTRING('.',IPAddress,1,start#) IF dot# THEN IP:Addr:B3 = IPAddress[start# : dot#-1] END ! IP:Num should now be the sortable numeric address This code is totally untested, but should give you the rough idea. Printed December 3, 2024, 12:00 pm This article has been viewed/printed 35205 times. |