How do I get similar functionality to the host
command using a c api (or any other language for that matter)? I need more information than just an IP address gi
I don't think there is a function in the C standard library for this, but many scripting languages do have this functionality 'built in'. For example, Perl has the Net::DNS package:
use Net::DNS;
my @mx = mx("example.com");
foreach $host (@mx) {
print $host;
}
If you need to do this in C, a quick google shows up a few C libraries out there which you can use: