title: Connect to WIFI from C program
body: <p>I am using these libraries at the moment to list available networks:</p>
  
  <pre><code>#include &lt;glib.h&gt;
  #include &lt;NetworkManager.h&gt;
  </code></pre>
  
  <p>(which works fine by the way)</p>
  
  <p>Now my question is, how do I connect to a specific network from my C program?
  I can't seem to find any good documentation or examples for it.</p>
  
  <p>What I did find was this: <a href="https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/glib/add-connection-libnm.c" rel="nofollow noreferrer">https://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/C/glib/add-connection-libnm.c</a></p>
  
  <p>But it does not suggest a way to actually connect to the added network.
  And also, if it matters; this code will be running on a Linux machine without a display so I'm not looking for anything that requires a graphical application.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks</p>