title: how to convert filesystem path to string
body: <p>I am iterating through all the files in a folder and just want their names in a string. I want to get a string from a <code>std::filesystem::path</code>. How do I do that?</p>
  
  <p>My code:</p>
  
  <pre><code>#include &lt;string&gt;
  #include &lt;iostream&gt;
  #include &lt;filesystem&gt;
  namespace fs = std::experimental::filesystem;
  
  int main()
  {
      std::string path = "C:/Users/user1/Desktop";
      for (auto &amp; p : fs::directory_iterator(path))
          std::string fileName = p.path;
  }
  </code></pre>
  
  <p>However I get the following error:</p>
  
  <pre><code>non-standard syntax; use '&amp;' to create a pointer to a member.
  </code></pre>