Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

aosmith

macrumors newbie
Original poster
Feb 9, 2007
2
0
SOLVED (It's my typo not xcode)
Code:
char *test = "acenusm.com";
hostptr = gethostbyname(test); 
printf("Host: %s\n", inet_ntoa(hostptr->h_addr));

(and a screen shot because it is legal code)

Picture.png


Any ideas?
 
Try hostent instead of hosten for hostptr.

Edit: Looks like you found it.

-Lee

It shows a principle that applies so often: Don't ask what's wrong with your compiler, or with your libraries, ask what is wrong with your code. The most common wrong assumption is the assumption that your own code is correct.

It also demonstrated nicely the need to post _complete_ source code, not the stuff that you think is important.
 
The most common wrong assumption is the assumption that your own code is correct.

this is something I run into all the time at work. The senior-most member of my team would blame crashes on "runtime" problems, "heap mismatches", etc. There are certainly times that there will be a compiler or runtime problem (I have had to fix a couple), but my first assumption is always something terrible in our code causing the problem. I need overwhelming evidence to believe that the issue lies elsewhere.

-Lee
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.