Hola conseguir hacer lo con este codigo:
memset(&configs,0,sizeof(configs));
configs.ai_protocol = IPPROTO_TCP;
configs.ai_socktype = SOCK_STREAM;
configs.ai_family = AF_INET;
configs.ai_flags = AI_PASSIVE;
iResult = getaddrinfo("www.pruebasdephp.hol.es","80",&configs,&result);
if(iResult != 0){
string msg = "Can't resolve google";
msg += itoa(iResult);
MessageBox(NULL,msg.c_str(),"Error",MB_ICONERROR);
}else
MessageBox(NULL,inet_ntoa((in_addr &)(result->ai_addr)),"Address",MB_ICONEXCLAMATION);
Usando getaddrinfo() pero aqui se necesita dar el protocolo, flags ...
params param;
hostent * host;
strcpy_s(param.web,80,"http://www.pruebasdephp.hol.es");
param.port = 80;
//now get the ip
cout << param.web;
host = gethostbyname(param.web);
in_addr addr;
memcpy_s(&addr,sizeof(in_addr),host->h_addr_list[0],host->h_length); // Infraccion de acceso
Aqui al utilizar gethostbyname() me tira un error de infraccion de acceso al copiar la memoria. Poruqe pasa esto?
Saludos