Hostname: Difference between revisions

Content added Content deleted
(+AutoHotkey)
Line 22: Line 22:
get(read OF execve child pipe("/bin/hostname","hostname",""), hostname);
get(read OF execve child pipe("/bin/hostname","hostname",""), hostname);
print(("hostname: ", hostname, new line))</lang>
print(("hostname: ", hostname, new line))</lang>
=={{header|AutoHotkey}}==
{{libheader|Ws2_32}}
<lang AutoHotkey>msgbox % gethostname()
gethostname()
{
start = 0
if !start
{
VarSetCapacity(wsaData, 32)
DllCall("Ws2_32\WSAStartup", "UShort", 0x0002, "UInt", &wsaData)
}
VarSetCapacity(name, 100, 88)
dllcall("Ws2_32.dll\gethostname", "str", name, "int", 100, "cdecl")
return name
}</lang>


=={{header|AWK}}==
=={{header|AWK}}==