DNS resolving in C/C++
Question: In python I can work with DNS like this:

    
    
    $ python
    Python 2.7.6 (default, Mar 22 2014, 22:59:56) 
    [GCC 4.8.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import dns.resolver
    >>> answer = dns.resolver.query('www.example.com')
    >>> print answer.response
    id 37102
    opcode QUERY
    rcode NOERROR
    flags QR RD RA
    ;QUESTION
    www.example.com. IN A
    ;ANSWER
    www.example.com. 3600 IN A 93.184.216.34
    ;AUTHORITY
    ;ADDITIONAL
    >>> print answer.rrset
    www.example.com. 3600 IN A 93.184.216.34
    >>>
    

What's the easiest way to achieve the same result in C/C++? Either using a
library (which one most popular?) or sending the request manuall via sockets
or something.


Answer: Start with [getaddrinfo](http://linux.die.net/man/3/getaddrinfo). Then the
[res_* functions](http://linux.die.net/man/3/resolver) for advanced queries.
These other functions might be useful to you as well.

[gethostbyname](http://linux.die.net/man/3/gethostbyname)

[getnameinfo](http://linux.die.net/man/3/getnameinfo)

[gethostent](http://linux.die.net/man/3/gethostent)

