Qualcosa del genere

codice:
   char     Hostname[100];
   HOSTENT *pHostEnt;

   gethostname( Hostname, sizeof( Hostname ));
   pHostEnt = gethostbyname( Hostname );
   printf ("%s\n", inet_ntoa(**((struct in_addr**)pHostEnt->h_addr_list)));
...