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
Ïà¹ØÎÊ´ð£º
ÎÊһϣº
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
ÏÖÔÚÓйØc++¡¢cµÄÊé¼®£¬ÄÇЩÊéÊǽÏÉî²ã´ÎµÄ£¿Çë½éÉܼ¸±¾£¿
#include <iostream>
using namespace std;
int funhion(int x, int y )
{
int m,n;
  ......
ÇëÎʸ÷λ¸ßÊÖÈçºÎÓÃC/C++»ñµÃϵͳδ°²×°²¹¶¡
ºÃÏñºÜרҵµÄ¶«Î÷¡£¡£¡£
²é×¢²á±í
ÿ¸ö²¹¶¡Èç¹û°²×°Á˶¼»áÔÚ×¢²á±íÀïÃæµÇ¼Ç
ÇëÎÊÄܲ»ÄܸüÇåÎúЩ£¬ÎÒÏëÓÃc\c++²é³öÀ´£¬²»ºÃÒâ˼£¬ÎÒÊÇÐÂÊÖ¡£»¹ÍûÖ¸½Ì¡£Ð»
·ÖÖµ ......
ÎÊÌâ:¹¤µØÉÏÐèÒª³¤¶ÈΪA1µÄ¸Ö½îX¸ù,³¤¶ÈΪA2µÄ¸Ö½îY¸ù,³¤¶ÈΪA3µÄ¸Ö½îZ¸ù......ÒÔ´ÎÀàÍÆ.
ÆäÖÐA1,A2,A3,...³¤¶ÈÈÎÒâÖ¸¶¨,X,Y,Z,...ÊýÁ¿Ò²ÈÎÒâÖ¸¶¨.
µ«²Ö¿âÖеĸֽîΪ±ê×¼³¤¶È,Ö»ÓÐ9Ã׺Í15Ã×Á½ÖÖ³¤¶È,ÊýÁ¿² ......
±³¾°£º
££££££££
Í·Îļþdb_method.h¾¹ýÃÀ»¯ºó´æÔÚÏÂÃ漸Öֽṹ¶¨ÒåÀàÐÍ
typedef struct
{
BYTE id;
BYTE idAsync;
DM_T dmInfo;
CHAR tbName[MAX_TBNAME_LEN];
} REC ......