X 表示以十六进制形式输出 02 表示不足两位,前面补0输出; 举例: printf("%02X", 0x123); //打印出:123 printf("%02X", 0x1); //打印出:01
char mac[32];
snprintf(mac, 6, "%2x:%2x:%2x:%2x:%2x:%2x",pe->Addr[0], pe->Addr[1], pe->Addr[2], pe->Addr[3],pe->Addr[4], pe->Addr[5]); //failed 应该为%02x memcpy(mac, pe->Addr, 6);