Get the host name and IP address of the computer
Author: editor: China Network Technology compiler: Liu Feng environment: Visual C 5 SP1 / 2 WINDOW NT4 or WINDOWS 95. Demand: #include Link Library: Wsock32.lib detailed code: {WORD wVersionRequested; WSADATA wsaData; Char name [255]; cstring ip; phostent hostinfo; wversionRequested = makeword (2, 0); if (WSAStartup (WSASTARTUP (WSASTARTASTED, & WSADATA) == 0) {IF (getHostName (name, sizeof (name)) == 0) { IF ((Hostinfo = gethostByname (Name))! = null) {ip = inet_ntoa (* (struct in_addr *) * Hostinfo-> h_addr_list);}} wsacleanup ();}}