title: Getting a directory name from a filename
body: <p>I have a filename (<code>C:\folder\foo.txt</code>) and I need to retrieve the folder name (<code>C:\folder</code>) in C++. In C# I would do something like this:</p>
  <pre><code>string folder = new FileInfo(&quot;C:\folder\foo.txt&quot;).DirectoryName;
  </code></pre>
  <p>Is there a function that can be used in C++ to extract the path from the filename?</p>