為什麼需要 & 0377
net-tools-1.60/lib/ether.c
37 /* Display an Ethernet address in readable format. */
38 static char *pr_ether(unsigned char *ptr)
39 {
40 static char buff[64];
41
42 snprintf(buff, sizeof(buff), "%02X:%02X:%02X:%02X:%02X:%02X",
43 (ptr[0] & 0377), (ptr[1] & 0377), (ptr[2] & 0377),
44 (ptr[3] & 0377), (ptr[4] & 0377), (ptr[5] & 0377)
45 );
46 return (buff);
47 }Last updated