me encontré con el siguiente código de instantáneas:¿Tiene struct hostent un campo "h_addr"?
struct hostent *hp;
hp = my_gethostbyname(localhost);
if (hp == NULL) {
ls_syslog(LOG_ERR, I18N_FUNC_FAIL, fname, "my_gethostbyname()");
return -1;
}
strcpy(localhost, hp->h_name);
memcpy(&addr, hp->h_addr, hp->h_length);
estoy bastante confusa por la última declaración, la declaración de hostent estructura es la siguiente:
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 */
};
No tiene un campo denominado " h_addr ", pero el código no se puede compilar, ¿alguien puede decirme por qué? Gracias.
Gracias ..... poco avergonzado .... – wangshuaijie