In a C program in UNIX, gethostbyname() can be used to obtain the address of domain like "localhost". How does one convert the result from gethostbyname() to dotted decimal notation.
struct hostent* pHostInfo;
/* get IP address from name */
printf("Could not resolve host name\n");
/* copy address into long */
memset(&nHostAddress, 0, sizeof(nHostAddress));
You can convert from a
struct in_addr directly to a string using
char *address = inet_ntoa(pHostInfo->h_addr);
The value you've got (16777243) looks wrong, though -- that comes out to 22.214.171.124!