linux»·¾³ÏÂgethostbynameº¯ÊýÎÊÌâ - C/C++ / CÓïÑÔ
дÁ˸ö²âÊÔ³ÌÐòÈçÏÂ
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
for(x2=0;hp->h_addr_list[x2];++x2)
{
strcpy(AlarmDevIP,inet_ntoa(*(struct in_addr*)hp->h_addr_list[x2]));
}
printf("%s", AlarmDevIP);
}
else
{
printf("get host by name error\n");
}
·¢Ïֵõ½µÄ½á¹û×ÜÊÇ error£¬ÇëÎÊÕâ¸öº¯Êý¶Ô³ÌÐòËùÔڵĻ·¾³ÓÐÒªÇó£¬ÎÒ²âÊÔ»·¾³ÔÚ¹«Ë¾ÄÚÍø£¬ÒªÍ¨¹ýÍø¹Ø²ÅÄܵ½ÍâÍøµÄ£¬ÁíÍâÄØÖªµÀÕâ¸öº¯ÊýµÄʵÏÖÊÇÔõô¸ö¹ý³ÌÂð£¿Ð»Ð»£¡
ûÓгõʼ»¯
int main( void )
{
WSADATA wsadata;
WSAStartup(MAKEWORD(2,2),&wsadata);
struct hostent *hp;
char AlarmDevIP[20];
int x2;
hp = gethostbyname("www.google.com");
if (hp)
{
for(x2=0;hp->h_addr_list[x2];++x2)
{
strcpy(AlarmDevIP,inet_ntoa(*(struct in_addr*)hp->h_addr_list[x2]));
}
printf("%s", AlarmDevIP);
}
else
{
printf("get host by name error\n");
}
return 0;
}
#include <netdb.h>
#include <sys/so
Ïà¹ØÎÊ´ð£º
QQȺ 29152388
ÓÑÇéUP
°ï¶¥
up
°ïup
up Ö§³Ö£¡
up jf
...ÄѵÀÓзÖ..?
up up up
Ï£ÍûÓеüӷ֣¬¹þ¹þ¡£
Ö§³Ö£¬ÎÒ¼ÓÁË£¬Ï£ÍûÂ¥Ö÷ÄܼÓÎÒ£¬¹²Í¬Ñ§Ï°¹þ
¼ÓÁË¡£
¶¥ÉÏ£¬Ã¿ÌìÊÕ»ñÒ»µã£¬Ö§³Ö ......
ĿǰÓöµ½µÄÎÊÌâÊÇ£º
´æ·ÅÔÚÔ¶³Ì·þÎñÆ÷¶Ëc/s³ÌÐòÒ»ÓиüУ¬ÈçºÎ×öµ½¿Í»§¶ËÁ¢¼´ÏìÓ¦µ¯³öÓÐ×îÐÂÉý¼¶µÄÌáʾ´°¿Ú¡£
±¾À´Óеã˼·£º²ÉÓÃWCF+windowns·þÎñ+¶¨Ê±Æ÷µÄ·½Ê½Ò²ÄÜʵÏÖ£¬µ«ÊÇÿ̨¿Í»§¶Ë»ú×Óÿ¸ô¶¼È¥·ÃÎÊÒ»ÏÂÔ¶³Ì ......
CÅÌÉ϶àµÄÎļþÃûΪ£ºdosh , Recycled ,System Volum information, AUTOEXEC.BAT, BOOT.INT , bootfoot.bin, CONFIG.SYS,IO.SYS, MSDOS.SYS, DETECT.COM ,ntldr, pagefile.sys;
¶øÇÒÿ¸öÅÌÉ϶¼ÓÐÕâЩÎļþ£ºRECYCLER ......