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
相关文档:
<!--
@page { margin: 2cm }
P { margin-bottom: 0.21cm }
-->
所谓“出租”(
rent
out
)就是一种很常见的租赁业务。在
IT
界,这种软、硬件(组合)的租赁业务也可算是一个“老古董”了。这个话题为什么最近又热闹起来了呢?
  ......
1。获得源代码
src 官网下载地址:ftp://ftp.qt.nokia.com/qt/source/
2009 年 10 月 1 日发布的 qt-x11-opensource-src-4.5.3.tar.gz,大小 122 Mb。
2。解压缩
tar xvfz qt-x11- ......
/etc/hosts一定要有严格的格式!!!
grid control 10.2.0.1.1安装注意事项
1.hostname
网络:
尽量使用静态IP,/etc/hosts的文件格式很重要,不知道是个BUG还是要求就是那么严格。我一开始就是在这吃的亏,在precheck需求的时候忽略了/etc/hosts检查失败的错误,结果安装软件没问题,但配置的时候出错 ......
1. 装系统
我装的双系统,Windows 7 和 Fedora 12.
1)我的C盘有50GB,所以我先分了区,分成3个,1个30GB,1个15GB,剩下的一个区3GB。
2)先装Windows 7在30GB的分区。
P:Sony的型号VGN-NR120E很变态,安装的时候必须要用最新补丁的安装盘才可以驱动到硬盘(导致不能装XP),可能是HDD ......
车水马龙,乱记点东西。
一开始不让我编译内核,结果是下面的问题导致:
1. sudo --- 拿root身份执行
2. apt-cache search ncurse --- 扫描所有带ncurse的资源
3. apt-get install libX-dev --- 安装开发用的lib库
4. cp -r --- 全面镜像复制
5. bz2 --- 压缩 tar jcvf 解压 tar jxvf
6. Ubuntu 生成 ......