inet_ntoa problem
Posted
by codingfreak
on Stack Overflow
See other posts from Stack Overflow
or by codingfreak
Published on 2010-03-25T06:46:09Z
Indexed on
2010/03/25
6:53 UTC
Read the original article
Hit count: 263
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 ??
© Stack Overflow or respective owner