DNS lookup in c/c++
I must write a C/C++ program which works a little bit like dig and nslookup: it must know IP addresses of any site. It should do things like the dig www.example.com MX +short command does. I can't imagine how can this be done. Any ideas?