#include<stdio.h>
#include<stdlib.h>
main()
{
FILE *p;
char c,buf[2];
char buff[12];
int k = 0,size = 0, j = 0, i;
system("ipconfig /all > w.txt");//获得ip配置信息
if ((p = fopen("w.txt","rb") )!= NULL)
{
while(!feof(p))
{
fread(&c,1,1,p);
if(c == '-' || j == 3 ){
for( i = 0; i < 2; i++)
{
buff[k] = buf[i];
k += 1;
size = 1;
}
}
if (k == 10)
j ++;
if ( size == 2)
size = 0;
buf[size] = c;
size ++;
if( k == 12)
break;
}
}
fclose(p);
printf("mac is :");
for(i = 0; i < 12 ; i ++)
{
printf("%c",buff[i]);
}
getchar();
}网卡获取代码。加密段自己写!