delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/04/14/04:46:49

From: tao_Zhou AT Shanghaigm DOT com
X-Lotus-FromDomain: SGM
To: djgpp AT delorie DOT com
Message-ID: <482568C1.002EF512.00@mercury.shanghaigm.com>
Date: Fri, 14 Apr 2000 16:24:51 +0900
Subject: How to use the "gethostbyname" function
Mime-Version: 1.0
Reply-To: djgpp AT delorie DOT com

In my program, I used the function "gethostbyname"
by which we can get the ip address through the hostname.
But to my surprise, it dosen't work as i expected. The way
i used it  is as followed:
if((h=gethostbyname(hostname))==NULL)
{    herror(strerror);
     printf("%s",strerror);
}
Everytime when i run the program, it always told me the
same message: unknown host.
What's up? Who can tell me how to satisfy this awful
function to make my program run properly?
 hungry for your help!


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019