1 #include <stdlib.h>
2 #include <stdio.h>
3 #include <sys/stat.h>
4 #include <sys/types.h>
5 #include <unistd.h>
6 #include <fcntl.h>
7 /*
8 * === FUNCTION ======================================================================
9 * Name: main
10 * Description:
11 * =====================================================================================
12 */
13 int
14 main ( int argc, char *argv[] )
15 {
16 int fd;
17 unsigned char mac_add[6];
18 if((fd = open(argv[1],O_RDWR)) == -1){
19 printf("open error\n");
20 exit(1);
21 }
22
23 if(lseek(fd,40,SEEK_SET) != 40){
24 printf("lseek error\n");
25 exit(1);
26 }
27
28 if(read(fd,mac_add,6) != 6){
29 printf("read error\n");
30 exit(1);
31 }
32 int i;
33 for ( i = 0; i < 6 ; i++ ){
34 printf("%x",mac_add[i]);
35 }
36 printf("\n");
37 close(fd);
38 return EXIT_SUCCESS;
39 } /* ---------- end of function main ---------- */