写了个小程序,MARK 一下。
#include
#include
void convert(char * mac)
{
char a;
printf("in convert mac is :%s \n",mac);
a=*mac;
while(a!='\0')
{
printf("char a=%c \n",a);
if((a>='A')&&(a<='Z'))
*mac=a+32;
a=*(++mac);
}
}
int main()
{
char mac[]="F4:06:69:6F:29:4E" ;
printf("test:%s len:%ld\n",mac,sizeof(mac));
if(18==sizeof(mac))
{
printf("hi i am test \n");
convert(mac);
printf("mac now is :%s \n",mac);
}
return 0;
}
~
运行结果:
oliver@4-me:~/test$ ./a.out
test:F4:06:69:6F:29:4E len:18
hi i am test
in convert mac is :F4:06:69:6F:29:4E
char a=F
char a=4
char a=:
char a=0
char a=6
char a=:
char a=6
char a=9
char a=:
char a=6
char a=F
char a=:
char a=2
char a=9
char a=:
char a=4
char a=E
mac now is :f4:06:69:6f:29:4e
阅读(3158) | 评论(0) | 转发(0) |