LinuxÏ»ñÈ¡MACµØÖ·
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <netinet/if_ether.h>
#include <string.h>
#include <netinet/ether.h>
#include<unistd.h>
int main(int argc, char **argv)
{
printf("helloworld\n");
int nSocket;
struct ifreq struReq;
nSocket = socket(PF_INET,SOCK_STREAM,0);
memset(&struReq,0,sizeof(struReq));
if(argc < 2)
strncpy(struReq.ifr_name, "eth0", sizeof(struReq.ifr_name));
else
strncpy(struReq.ifr_name, argv[1], sizeof(struReq.ifr_name));
ioctl(nSocket,SIOCGIFHWADDR,&struReq);
fprintf(stderr, "%d-%s\n", __LINE__, strerror(errno));
printf("%s \n", ether_ntoa( (const ether_addr*)(struReq.ifr_ifru.ifru_hwaddr.sa_data)));
close(nSocket);
}
man reference
http://linux.die.net/man/7/netdevice
Ïà¹ØÎĵµ£º
sortÃüÁî
sortÃüÁîµÄ¹¦ÄÜÊǶÔÎļþÖеĸ÷ÐнøÐÐÅÅÐò¡£sortÃüÁîÓÐÐí¶à·Ç³£ÊµÓõÄÑ¡ÏÕâЩѡÏî×î³õÊÇÓÃÀ´¶ÔÊý¾Ý¿â¸ñʽµÄÎļþÄÚÈݽøÐи÷ÖÖÅÅÐò²Ù×÷µÄ¡£Êµ¼ÊÉÏ£¬sortÃüÁî¿ÉÒÔ±»ÈÏΪÊÇÒ»¸ö·Ç³£Ç¿´óµÄÊý¾Ý¹ÜÀí¹¤¾ß£¬ÓÃÀ´¹ÜÀíÄÚÈÝÀàËÆÊý¾Ý¿â¼Ç¼µÄÎļþ¡£
SortÃüÁÖðÐжÔÎļþÖеÄÄÚÈݽøÐÐÅÅÐò£¬Èç¹ûÁ½ÐеÄÊ××Ö·ûÏàͬ£¬¸ÃÃüÁî½ ......
Linux select()Ïê½â selectϵͳµ÷ÓÃÊÇÓÃÀ´ÈÃÎÒÃǵijÌÐò¼àÊÓ¶à¸öÎļþ¾ä±ú(file descriptor)µÄ״̬±ä»¯µÄ¡£³ÌÐò»áÍ£ÔÚselectÕâÀïµÈ´ý£¬Ö±µ½±»¼àÊÓµÄÎļþ¾ä±úÓÐijһ¸ö»ò¶à¸ö·¢ÉúÁË״̬¸Ä±ä¡£ ÎļþÔÚ¾ä±úÔÚLinuxÀïºÜ¶à£¬Èç¹ûÄãmanij¸öº¯Êý£¬ÔÚº¯Êý·µ»ØÖµ²¿·Ö˵µ½³É¹¦ºóÓÐÒ»¸öÎļþ¾ä±ú±»´´½¨µÄ¶¼Êǵģ¬Èçman socket¿ÉÒÔ¿´µ½&ldqu ......
±à¼gedit /etc/fstab:
//192.168.1.1/winshare /mnt/share defaults,auto,username=windowsÓû§Ãû, password=windowsÃÜÂë 0 0
±¸×¢£º
£¨1£©ÖÕ¶ËÃüÁîÐйÒÔØ£ºmount //192.168.1.1/winshare /mnt/share -o user=windowsÓû§Ãû%windowsÃÜÂë
£¨2£©etc/rc.d/rcÔò¸ù¾ÝÆä²ÎÊýÖ¸¶¨µÄÔËÐÐģʽ(ÔËÐм¶±ð£¬ÔÚinittabÎļþÖпÉÒÔÉèÖ ......
ǶÈëʽLinux²Ù×÷ϵͳѧϰ¹æ»®
ARM+LINUX·Ïߣ¬Ö÷¹¥Ç¶ÈëʽLinux²Ù×÷ϵͳ¼°ÆäÉÏÓ¦ÓÃÈí¼þ¿ª·¢Ä¿±ê£º
£¨1£© ÕÆÎÕÖ÷Á÷ǶÈëʽ΢´¦ÀíÆ÷µÄ½á¹¹ÓëÔÀí£¨³õ²½¶¨Îªarm9£©
£¨2£© ±ØÐëÕÆÎÕÒ»¸öǶÈëʽ²Ù×÷ϵͳ £¨³õ²½¶¨Îªuclinux»òlinux,°æ±¾´ý¶¨£©
£¨3£© ±ØÐëÊìϤǶÈëʽÈí¼þ¿ª·¢Á÷³Ì²¢ÖÁÉÙ×öÒ ......