strIp = inet_ntoa (*(struct in_addr*) &ip)
Here ip should be in correct byte order, for example, a number returned by inet_addr ()