inet_ntoa problem
- by codingfreak
Hi
I am declaring following variables
unsigned long dstAddr;
unsigned long gateWay;
unsigned long mask;
These variables contains ipaddresses in network byte order. So when I am trying to print them using inet_ntoa function for mask variable sometimes it is printing strange values
printf("%s\t%s\t%s\t",inet_ntoa(dstAddr),inet_ntoa(gateWay),inet_ntoa(mask));
192.168.122.0 0.0.0.0 0.255.255.255
but it should be
192.168.122.0 0.0.0.0 255.255.255.0
So is this because of inet_ntoa ??