0

I'm trying to make a DNS in Ubuntu and sometimes I have to use the dig command(I'm using test=system("dig www.google.com") How can I get the IPv4 from the return of the dig command to them be able to use it?

1 Answers1

0

Do you mean "make a DNS lookup"? If so, try the functions gethostbyname and gethostbyaddr. This is much more efficient than dig.

Or do you specifically want the output of dig? If so, use popen().

abligh
  • 24,573
  • 4
  • 47
  • 84