6 unsigned long int counter
= 0;
8 if ((fd
= fopen("/tmp/maccounter", "r")) != NULL
) {
9 fread(mac
, 12, sizeof(char), fd
);
11 counter
= strtoul(mac
, NULL
, 16);
16 snprintf(mac
, 13, "%012X\n", counter
);
17 if ((fd
= fopen("/tmp/maccounter", "w")) != NULL
) {
18 fwrite(mac
, 12, sizeof(char), fd
);