GETHOSTNAME(2)
NAME
gethostname − get name of current host
SYNOPSIS
char hostname[];
gethostname(hostname, sizeof (hostname));
HP-UX COMPATIBILITY
Level: HP-UX/RUN ONLY
Origin: UCB
DESCRIPTION
Gethostname returns the standard host name for the current processor, as set by sethostname(2). The name is truncated to sizeof(hostname)-1 and is null-terminated.
Gethostname can fail if:
[EFAULT] Hostname points to an illegal address.
SEE ALSO
hostname(1), uname(1), sethostname(2), uname(2).
Hewlett-Packard — last mod. May 11, 2021