Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

gethostname - get name of current host

&pagelevel(4)&pagelevel

Syntax

#include <unistd.h>

int gethostname(char *name, size_t namelen);

Description gethostname() determines the default name of the current host. The namelen parameter

specifies the size of the file pointed to by name. A trailing zero is appended to the name,
provided namelen is long enough.
If the host name exceeds the value namelen, the name is truncated and it is not guaranteed
that a trailing zero will be appended.

Return val.

0

-1

if successful.

otherwise.

See also

gethostid(), unistd.h.