#include "stdafx.h"
#include "winsock.h"
#include "stdio.h"
#pragma comment(lib,"ws2_32")
int main(int argc, char* argv[])
{
char host[1024];
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD( 2, 0 );
WSAStartup(wVersionRequested, &wsaData);
if (!gethostname(host, sizeof(host)))
{
hostent* hostid = gethostbyname(host);
printf("%s/n", inet_ntoa(*(struct in_addr *) hostid->h_addr));
}
WSACleanup( );
return 0;
}