If I have a 4 byte address stored in char address[4] and the contents are:
address[0] = '\x80';
address[1] = '\xAB';
address[2] = '\x0A';
address[3] = '\x1C';
// all together: 80 AB 0A 1C
I want to convert it to a character array that looks like "128.171.10.28", since 80 in hex is 128, AB in hex is 171 and so on.
How can I do this?
or
or, as pointed out by dreamlax:
An IP address ist just the individual octets printed as decimal separated by a .
You probably should make your
char address[4]
anunsigned char address[4]
Using %u would be even better.