关于gethostbyaddr函数的使用问题??????????????????
我刚刚学习c的网络编程,用dec++编写了下面的一小段程序,编译可以通过,可是运行是就弹出某地址无法read,大家帮忙看看
#include <iostream>
#include <windows.h>
#include <winsock2.h>
#pragma comment ( lib, "ws2_32.lib" )
#pragma comment ( lib, "Iphlpapi.lib" )
using namespace std;
int main(int argc, char *argv[])
{char *name;
struct hostent *pp;
pp= (struct hostent*)malloc( sizeof(struct hostent ));
pp= gethostbyaddr(name,4,AF_INET);
printf("%d\n",pp->h_name);
system("PAUSE");
return EXIT_SUCCESS;
}