i wrote this little bit of code. it works on my computer. it will show your ip and your host name. just create a Win32 Console app and add wsock32.lib to the project.
Code:
#include<windows.h>
#include<iostream.h>
int main()
{
LPHOSTENT szHost_IP;
struct in_addr in_IP;
char szHost_Name[255],
szYour_IP[255];
WSADATA WSAData;
if(WSAStartup(MAKEWORD(2,0), &WSAData))
{
cout<<"ERROR";
return 0;
}
gethostname(szHost_Name, sizeof(szHost_Name));
szHost_IP = gethostbyname(szHost_Name);
in_IP = *(struct in_addr FAR *)(szHost_IP->h_addr);
wsprintf(szYour_IP, "Your Host Name - %s\n\n", szHost_Name);
cout<<szYour_IP;
wsprintf(szYour_IP, "Your IP - %s\n\n", inet_ntoa(in_IP));
cout<<szYour_IP;
return 0;
}
hope it works. if not re-post.