Ma leggere la documentazione?

gethostbyname
http://msdn.microsoft.com/en-us/libr...24(VS.85).aspx

If no error occurs, gethostbyname returns a pointer to the hostent structure described above. Otherwise, it returns a null pointer and a specific error number can be retrieved by calling WSAGetLastError