首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C语言 >

strcpy(pszIpAddr, inet_ntoa(*(struct in_addr *)*host->h_addr_list) );求解释,该怎么处

2012-10-12 
strcpy(pszIpAddr, inet_ntoa(*(struct in_addr *)*host-h_addr_list) )求解释strcpy(pszIpAddr, inet_n

strcpy(pszIpAddr, inet_ntoa(*(struct in_addr *)*host->h_addr_list) );求解释
strcpy(pszIpAddr, inet_ntoa(*(struct in_addr *)*host->h_addr_list) );

具体的,谢谢,主要是参数都是做什么的,看了百度百科有点迷糊了,尤其是这个‘->’的意思,以前没见过啊

[解决办法]

C/C++ code
strcpy(    pszIpAddr,    inet_ntoa(        *            (struct in_addr *)                *                    host->h_addr_list    ));
[解决办法]
host->h_addr_list

*(host->h_addr_list)

(struct in_addr *)*(host->h_addr_list)

*(struct in_addr *)*(host->h_addr_list)


看清楚4个步骤, 然后看看结构体:

C/C++ code
              struct hostent {                      char    *h_name;        /* official name of host */                      char    **h_aliases;    /* alias list */                      int     h_addrtype;     /* host address type */                      int     h_length;       /* length of address */                      char    **h_addr_list;  /* list of addresses */              }              #define h_addr  h_addr_list[0]  /* for backward compatibility */ 

热点排行