next up previous
Next: exec Up: Unix & Linux Previous: Directory reading

Get official Host name

int rc = gethostname(buf, bufsize);
if (rc == -1) {
    msl_warn("can't get host name " << strerror(errno));
}
else {
    struct hostent *host  = gethostbyname(buf);
    m_host = host->h_name;
}



Wei Lu 2007-11-06