printf("sizeof(h_addr_list[0]) is %lu\n",sizeof(ret_hostent->h_addr_list[0]));//long unsigned int printf("strlen(h_addr_list[0]) is %zu\n",strlen(ret_hostent->h_addr_list[0]));//size_t //type: int char char* unsigned int long unsigned int size_t float double long i...
short h_addrtype; /* host address type */ short h_length; /* length of address */ char FAR * FAR * h_addr_list; /* list of addresses */ #define h_addr h_addr_list[0] /* address, for backward compat */ }; h_addr_list其实是一个指针数组,数组中每个元素都是in_addr型指针。 t...
h_addr_list 是char 那么取元素就去掉一个星号,于是h_addr_list[0]一是char *。就好比char *p中,p是char *,所以p[0]就是去掉一个星号,也就是char
这个地方错了。struct hostent { char *h_name;char **h_aliases;int h_addrtype;int h_length;char **h_addr_list;define h_addr h_addr_list[0]};h_length 表示的是主机ip地址的长度 h_addr_list :表示的是主机的ip地址 所以应该是直接打印:printf("IP adderss:%s\n...
&hostEntry->h_addr_list保存一组ip,有几块网卡,每块网卡设置多个ip,2即是第3个ip
刷刷题APP(shuashuati.com)是专业的大学生刷题搜题拍题答疑工具,刷刷题提供h_addr_list[0]主机的IP地址,是网络字节序A.正确B.错误的答案解析,刷刷题为用户提供专业的考试题库练习。一分钟将考试题Word文档/Excel文档/PDF文档转化为在线题库,制作自己的电子错题本,提高学
{ char * h_name; //主机的正式名称 char * * h-aliases; //别名列表 int h_addrtype; //主机地址类型:af-xxx int h_length; //主机地址长度:4 b(32 b) char * * h_addr_list; //主机ip地址列表} define h???-addr h-addr-list[0] sockaddr_in类型的结构定义:sockaddr_in是通用套接字...
inet_ntoa (*(struct in_addr *)*hp->h_addr);
linux's `include/uapi/linux/in6.h'. - Allow including the headers in either other. - First header included defines the structures and macros. Details: === The kernel promises not to break the UAPI ABI so I don't see why we can't just have the two userspace headers coordinate?