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

ÔÚlinuxÏ »ñÈ¡±¾»úMACµØÖ·µÄº¯Êý

//»ñÈ¡±¾»úMACµØÖ·º¯ÊýQString GetLocalMac()
{
int sock_mac;

struct ifreq ifr_mac;
char mac_addr[30];

sock_mac = socket( AF_INET, SOCK_STREAM, 0 );
if( sock_mac == -1)
{
perror("create socket falise...mac\n");
return "";
}

memset(&ifr_mac,0,sizeof(ifr_mac));
strncpy(ifr_mac.ifr_name, "eth0", sizeof(ifr_mac.ifr_name)-1);
if( (ioctl( sock_mac, SIOCGIFHWADDR, &ifr_mac)) < 0)
{
printf("mac ioctl error\n");
return "";
}

sprintf(mac_addr,"%02x%02x%02x%02x%02x%02x",
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[0],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[1],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[2],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[3],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[4],
(unsigned char)ifr_mac.ifr_hwaddr.sa_data[5]);
printf("local mac:%s \n",mac_addr);

close( sock_mac );
return QString( mac_addr );
}


Ïà¹ØÎĵµ£º

ʵսLinux Bluetooth±à³Ì£¨Èý£© HCI²ã±à³Ì

1. HCI²ãЭÒé¸ÅÊö£º
HCIÌṩһÌ×ͳһµÄ·½·¨À´·ÃÎÊBluetoothµ×²ã¡£ÈçͼËùʾ£º
´ÓͼÉÏ¿ÉÒÔ¿´³ö£¬Host Controller Interface(HCI)  ¾ÍÊÇÓÃÀ´¹µÍ¨HostºÍModule¡£Hostͨ³£¾ÍÊÇPC£¬ ModuleÔòÊÇÒÔ¸÷ÖÖÎïÀíÁ¬½ÓÐÎʽ£¨USB,serial,pc-cardµÈ£©Á¬½Óµ½PCÉϵÄbluetooth Dongle¡£
ÔÚHostÕâÒ»¶Ë£ºapplication,SDP,L2capµÈЭÒé ......

linux쵀printf

      ÓÐʱ²»ÒªÒÔΪprintfÒ»¶¨ÄÜ´òÓ¡³öÊý¾ÝÀ´¡£ÓÐʱ£¬Äã²»ÔÚ³ÌÐòµÄÿ¸öµØ·½printfµÄµØ·½¶¼²»¼ÓÉÏ"\n”,³ÌÐò¸ù±¾¾Í²»´òÓ¡ÈκÎÊý¾Ý³öÀ´£¬ÐŲ»£¿£¡ÎҾ͵¹Ã¹µÄÓöµ½¸öÒ»´Î¡£Óöµ½ÕâЩºÜÍ·Ì۵쬻¹ÒÔΪÊdzÌÐòÄĶù³ö´í¿©¡£Ô­À´ÕâÊÇÒòΪ£¬ËüÆäʵÓлº³åµÄ¹¦ÄÜ£¬Ö»ÓÐÔÚ“\n”£¬Ëü²Å½«»º³åÀïµÄ ......

LinuxµÄÓû§ºÍÓû§×é¹ÜÀí

                      LinuxµÄÓû§ºÍÓû§×é¹ÜÀí
LinuxϵͳÊÇÒ»¸ö¶àÓû§¶àÈÎÎñµÄ·Öʱ²Ù×÷ϵͳ£¬ÈκÎÒ»¸öҪʹÓÃϵͳ×ÊÔ´µÄÓû§£¬¶¼±ØÐëÊ×ÏÈÏòϵͳ¹ÜÀíÔ±ÉêÇëÒ»¸öÕ˺ţ¬È»ºóÒÔÕâ¸öÕ˺ŵÄÉí·Ý½øÈëϵͳ¡£Óû§µÄÕ˺ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ