10 unsigned long int mac
;
11 int fd
= open("/mnt/netapp/maccounter", O_RDWR
|O_CREAT
|O_TRUNC
);
13 FILE * fd2
= fdopen(fd
, "r");
15 if (fd2
== NULL
) printf("ga dood\n");
16 if (fread(filemac
, sizeof(char), 13, fd2
) == 0) {
23 mac
= strtoul(filemac
, NULL
, 16);
24 printf("cur: %06X\n", mac
);
26 snprintf(filemac
, 13, "%06X", mac
);
27 printf("next: %s\n", filemac
);
29 lseek(fd
, 0, SEEK_SET
);
30 write(fd
, &filemac
, 13);