#include #include // get/set hostname #include // for HOST_NAME_MAX //#include // perror #include //errno using namespace std; const int LEN = HOST_NAME_MAX; int main() { char name[LEN]; char eName[1]; cout << "Before the call errno is " << errno << endl; gethostname(eName, 1); cout << "After the first call errno is " << errno << endl; sethostname(eName, 1); cout << "After the second call errno is " << errno << endl; cout << "After the second call errno is " << errno << endl; return 0; }