on-internet
← Community

Convert domain name to IP address with getaddrinfo using c++

Stack Overflow ·

I created a function using the deprecated gethostbyname to convert a domain name to an IP address. It works, however this causes lots of warnings and my work wants me to use the newer getaddrinfo. getaddrinfo prints the IP address, the gateway information and more. All I want is the IP address of the domain name. From placing break points in the function I see it is the 5th variable in the structure. My work does not want me to loop 5 times as this could change in the future. I doubt that but still. Is there a way I can access the structure or set - read a flag to get just the IP address of th

Comments

Sign in or sign up to comment and upvote.

No comments yet.