Public domain
#include <stdio.h>
#include <string.h>
#include <arpa/inet.h>
int main()
{
char dst[INET_ADDRSTRLEN];
struct in_addr src;
src.s_addr = 0x142AAA53;
inet_ntop(AF_INET, &src, dst, INET_ADDRSTRLEN);
printf("Network = %X\n", src.s_addr);
printf("Presentation = %s\n", dst);
return 0;
}
BY: Pejman Moghadam
TAG: c, inet-ntop
DATE: 2014-01-21 02:04:33