title: Glob in C++ and print the results
body: <p>I'm just trying to glob everything in a directory and print the list of results, but I get an empty printf:</p>
  
  <pre><code>#include &lt;glob.h&gt;
  #include &lt;stdio.h&gt;
  
  int main()
  {
    int result;
    glob_t buffer;
    buffer.gl_offs = 10;
    glob("*", GLOB_DOOFFS, NULL, &amp;buffer);
    printf((char*)buffer.gl_pathv);
  }
  </code></pre>
  
  <p>What does work is</p>
  
  <pre><code>printf("%i", buffer.gl_pathc));
  </code></pre>