#include #include // get/set hostname #include // for HOST_NAME_MAX #include // perror #include //errorno using namespace std; const int LEN = HOST_NAME_MAX; int main() { char name[LEN]; gethostname(name, LEN); cout << "The host name is " << name << endl; return 0; }