Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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


Ïà¹ØÎÊ´ð£º

C ³ÌÐòÎÊÌâ (¶þ) - C/C++ / CÓïÑÔ

ÎÊһϣº
#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µÄ֪ʶ

      ÏÖÔÚÓйØc++¡¢cµÄÊé¼®£¬ÄÇЩÊéÊǽÏÉî²ã´ÎµÄ£¿Çë½éÉܼ¸±¾£¿


#include <iostream>
using namespace std;
int funhion(int x, int y )
{
int m,n;
    ......

ÈçºÎ²éÕÒϵͳδ°²×°²¹¶¡C - C/C++ / ÐÂÊÖÀÖÔ°

ÇëÎʸ÷λ¸ßÊÖÈçºÎÓÃC/C++»ñµÃϵͳδ°²×°²¹¶¡
ºÃÏñºÜרҵµÄ¶«Î÷¡£¡£¡£

²é×¢²á±í
ÿ¸ö²¹¶¡Èç¹û°²×°Á˶¼»áÔÚ×¢²á±íÀïÃæµÇ¼Ç

ÇëÎÊÄܲ»ÄܸüÇåÎúЩ£¬ÎÒÏëÓÃc\c++²é³öÀ´£¬²»ºÃÒâ˼£¬ÎÒÊÇÐÂÊÖ¡£»¹ÍûÖ¸½Ì¡£Ð»

·ÖÖµ ......

[Çó¸Ö²ÄÇиîÎÊÌâµÄC/C++Ë㷨ʵÏÖ]

ÎÊÌâ:¹¤µØÉÏÐèÒª³¤¶ÈΪA1µÄ¸Ö½îX¸ù,³¤¶ÈΪA2µÄ¸Ö½îY¸ù,³¤¶ÈΪA3µÄ¸Ö½îZ¸ù......ÒÔ´ÎÀàÍÆ.
ÆäÖÐA1,A2,A3,...³¤¶ÈÈÎÒâÖ¸¶¨,X,Y,Z,...ÊýÁ¿Ò²ÈÎÒâÖ¸¶¨.

µ«²Ö¿âÖеĸֽîΪ±ê×¼³¤¶È,Ö»ÓÐ9Ã׺Í15Ã×Á½ÖÖ³¤¶È,ÊýÁ¿² ......

ÇóÕäÆ·£¬´ÓÍ·ÎļþÖн«C½á¹¹½âÎö²¢Êä³ö³öÀ´¡£

±³¾°£º
£­£­£­£­£­£­£­£­
Í·Îļþdb_method.h¾­¹ýÃÀ»¯ºó´æÔÚÏÂÃ漸Öֽṹ¶¨ÒåÀàÐÍ
typedef struct
{
BYTE id;
BYTE idAsync;
DM_T dmInfo;
CHAR tbName[MAX_TBNAME_LEN];
} REC ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ