struct ethernet_header { u_char ether_dhost[ ETHER_ADDR_LEN]; u_char ether_shost[ETHER_ADDR_LEN]; u_short ether_type; }; for(i = 0;i <6; i++) printf(
How about:
printf("%02x:%02x:%02x:%02x:%02x:%02x", (unsigned)ethernet->ether_dhost[0], (unsigned)ethernet->ether_dhost[1], (unsigned)ethernet->ether_dhost[2], (unsigned)ethernet->ether_dhost[3], (unsigned)ethernet->ether_dhost[4], (unsigned)ethernet->ether_dhost[5]);