Mood: hungry
Topic: VC++
It is easy to get the name of a machine. Make sure your application supports "winsock" WSADATA WSAData; ::ZeroMemory(&WSAData, sizeof(WSAData)); //init winsock ::WSAStartup(MAKEWORD(1,0), &WSAData); Now get the host name: char szHostName[MAX_PATH]; ::gethostname(szHostName, MAX_PATH); szHostName has got the host name Now close winsock. //close winsock ::WSACleanup();
Posted by Nibu babu thomas
at 1:33 PM
Updated: Tuesday, 20 December 2005 1:38 PM