• Welcome to Powerbasic Museum 2020-B.
 

Using "USING" and BYTE pointers & how to make a LONG IP-Adress into X.X.X.X

Started by Theo Gottwald, January 16, 2011, 11:11:08 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Theo Gottwald

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