ipaddress to hostname without a single shred of error checking. This code will take an ipaddress as an argument and return the hostname associated with it using gethostbyaddr. It should have more error checking and a lot of other stuff, but this is just to show the base code. Cut and paste away.
[includecode#../code/gethostbyaddr.c]