Powerbasic Museum 2020-B

IT-Berater: Theo Gottwald (IT-Consultant) => General Tips and Discussion => Topic started by: Theo Gottwald on January 16, 2011, 11:11:08 AM

Title: Using "USING" and BYTE pointers & how to make a LONG IP-Adress into X.X.X.X
Post by: Theo Gottwald on January 16, 2011, 11:11:08 AM
This is a nice example how to save a Loop by using the builtin "USING$" command.

' IP-Adress(Long)->IP-Adress (String)
FUNCTION IP_Adress(BYVAL T01 AS LONG) AS STRING
LOCAL T02 AS STRING, T03 AS BYTE PTR
T03 = VARPTR(T01)
T02 = USING$("#_.#_.#_.#", @T03, @T03[1], @T03[2], @T03[3])
FUNCTION = T02
END FUNCTION