RosettaCodeData/Task/Hostname/Liberty-BASIC/hostname.basic
2023-07-01 13:44:08 -04:00

8 lines
262 B
Text

lpBuffer$=Space$(128) + Chr$(0)
struct SIZE,sz As Long
SIZE.sz.struct=Len(lpBuffer$)
calldll #kernel32, "GetComputerNameA",lpBuffer$ as ptr, SIZE as struct, result as Long
CurrentComputerName$=Trim$(Left$(lpBuffer$, SIZE.sz.struct))
print CurrentComputerName$