res_ninit/res_init functions

Sapir

New Member
Joined
Dec 2, 2020
Messages
14
Reaction score
1
Credits
122
hi everyone:)
I have a question about how those functions work..
I try to parse the file etc/resolv.conf and I know that it returns a struct that includes a list of DNS servers(IP).
We try to print the list of those servers but it print :
1) port 0
2) and IP 0
(The ways we tried to print were: '._res.nsaddr_list[0]' and '._res.nsaddr_list[0].sin_addr.s_addr')

How can I print the actual list? maybe the way I try to print is wrong.
(if it's relevant I work with chromium project open source)

Thank you in advance!
 


not sure what your objective is - do you mean simply get the output of /etc/resolv.conf

if so you can just use:

cat /etc/resolv.conf > /home/username/Desktop/outputOfresolv.txt
 
I want to print the list of DNS servers(IP) from C++ code.
So i tried to get the content of the file: etc/resolv.conf with res_ninit function.
 
Last edited:


Top