Hallo!
I got the following Decimal IP: "3232235876" it represents "192.168.1.100"
I got it in the following way:
Code:
//GET IP
if (gethostname(hostname, sizeof(hostname)) == SOCKET_ERROR) {
printf("%s","host not found");
}
struct hostent *phe = gethostbyname(hostname);
memcpy(&addr, phe->h_addr_list[0], sizeof(struct in_addr));
//Convert IP to Decimal notation
sprintf(decResult,"%u", addr);
sprintf(decResult,"%u", htonl(atoi(decResult)));
But now is my question how do I reconvert it to the Dotted Decimal Notation?
I know it's done with 'inet_ntoa' function but I first need to get '3232235876' converted something else and then I need to convert that to addr.
To both those questions I don't know the answer :/
Kind regards.