I\'m preparing for a quiz, and I have a strong suspicion I may be tasked with implementing such a function. Basically, given an IP address in network notation, how can we ge
You actually can use an inet function. Observe.
main.c:
#include
main() {
uint32_t ip = 2110443574;
struct in_addr ip_addr;
ip_addr.s_addr = ip;
printf("The IP address is %s\n", inet_ntoa(ip_addr));
}
The results of gcc main.c -ansi; ./a.out is
The IP address is 54.208.202.125
Note that a commenter said this does not work on Windows.