title: Programmatically obtain DNS servers of host
body: <p>Using C++, I would like to obtain the DNS servers being used by a host for three operating systems: OS X, FreeBSD, and Windows. I'd like confirmation that the approaches below are indeed best practice, and if not, a superior alternative. </p>
  
  <ul>
  <li><strong>OS X</strong>: <a href="https://stackoverflow.com/questions/260518/finding-dns-server-settings-programmatically-on-mac-os-x/260534#260534">already answered</a>; updated link at <a href="http://developer.apple.com/mac/library/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_UnderstandSchema/SC_UnderstandSchema.html#//apple_ref/doc/uid/TP40001065-CH203-TPXREF103" rel="nofollow noreferrer">developer.apple.com</a></li>
  <li><strong>Windows</strong>: <a href="http://msdn.microsoft.com/en-us/library/aa365968(VS.85).aspx" rel="nofollow noreferrer"><code>GetNetworkParams</code></a></li>
  <li><strong>FreeBSD</strong>: <code>/etc/resolv.conf</code></li>
  </ul>
  
  <p>Thanks in advance for your help!</p>