Курсовая работа: Информационная система сравнительного анализа работы компьютера
hostent *sh;
sh=gethostbyname ( (char*) &chInfo);
if (sh! =NULL)
{
strcat (lpszSystemInfo, "Имя доступной локальной машины: \t");
strcat (lpszSystemInfo, sh->h_name);
strcat (lpszSystemInfo, " ");
int n_long = strlen (lpszSystemInfo);
lpszSystemInfo [n_long] = 13;
lpszSystemInfo [n_long+1] = 10;
int nAdapter = 0;
while (sh->h_addr_list [nAdapter])
{
struct sockaddr_in adr;
memcpy (&adr. sin_addr,sh->h_addr_list [nAdapter],sh->h_length);
strcat (lpszSystemInfo, "IP адрес локальной машины: \t");
strcat (lpszSystemInfo, inet_ntoa (adr. sin_addr));
strcat (lpszSystemInfo, " ");
int n_long = strlen (lpszSystemInfo);
lpszSystemInfo [n_long] = 13;
lpszSystemInfo [n_long+1] = 10;
nAdapter++;
}
}
WSACleanup (); }
}
/*NCB SNcb; // Структура для работы с NetBios
CHARrc= 0; // Код возврата
CHARStatus [256]; // Буфер для получения данных