IP ADDRESS OF MACHINE

John Love-Jensen eljay@adobe.com
Thu Feb 28 06:49:00 GMT 2002


Hi Nelson,

Change the one line to...
    typedef unsigned char byte;
     printf ("address:    %hhu.%hhu.%hhu.%hhu\n", \
       (*entry)[0] & 0xFF,
       (*entry)[1] & 0xFF,
       (*entry)[2] & 0xFF,
       (*entry)[3] & 0xFF);

What you are seeing is an octet being treated as signed, and the signed
extension value being displayed as an unsigned int.

The mask will slice the sign extended high-bits off properly.

--Eljay




More information about the Gcc-help mailing list