Convert hostname to IP address

How do I convert a hostname to IP address ?

Example :
    HostName : "MyHost"
    IP       :

How do I convert "MyHost" to "" ?

Thank you!
Who is Participating?
afzalmjConnect With a Mentor Commented:
Easy, use gethostbyname() under winsock, win32.
It will need a struct hostent *host structure, and this will contain relevant ip address. Also, use gethostbyaddr() to convert from ip to host.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.