COHERENT manpages

This page displays the COHERENT manpage for gethostname() [Get the name of the local host].

List of available manpages
Index


gethostname() -- Sockets Function (libsocket)

Get the name of the local host
#include <sys/utsname.h>
int gethostname (name, length)
char *name;
int length;

Function gethostname() reads the name of your local host.

name points to the chunk of memory into which gethostname() is to write the
name of the local host.  length gives the length of that chunk of memory.

gethostname() returns -1  if it could not read the  name of the local host.
Otherwise, it returns zero.

See Also

libsocket

Notes

name must point  to enough memory to hold the  name of your local host.  If
it  does not,  the behavior  of  this function  is undefined  (and probably
unwelcome).  Caveat utilitor.