title: How to get the filename
body: <p>I want to get the filename from a <code>vector &lt;wstring&gt;</code> after the search operation i want to copy all the files on the <code>vecAviFiles</code> to another path (for example D:\Test).</p>
  
  <pre><code> int main()
      {
        int                      iRC         = 0;
        std::vector&lt;std::wstring&gt; vecAviFiles;
        std::wstring fileCopiedDestination = L"D:\\";
  
  
  
  
  
    // Search 'c:' for '.avi' files including subdirectories
    iRC = SearchDirectory(vecAviFiles, L"c:\\", L"doc");
    if(iRC)
    {
      std::cout &lt;&lt; "Error " &lt;&lt; iRC &lt;&lt; std::endl;
      return -1;
    }
  
    // Print results
    for(std::vector&lt;std::wstring&gt;::iterator iterAvi = vecAviFiles.begin(); iterAvi != vecAviFiles.end(); ++iterAvi)
      {
  
          std::wcout &lt;&lt; *iterAvi &lt;&lt; std::endl;
          copy_file(*iterAvi,fileCopiedDestination + path::filename(*iterAvi));
  
      }
  
      return 0;
  }
  </code></pre>
  
  <p>The problem is in this function (it's not working) of the boost library <code>copy_file(*iterAvi,fileCopiedDestination + path::filename(*iterAvi));</code> how can i get the filename to add it to the <code>fileCopiedDestination</code> path.
  or how can i do the samething using this function from the <code>WIN API</code></p>
  
  <pre><code>CopyFileW(Input.c_str(),filename(Input.c_str()) , TRUE);
  </code></pre>
  
  <p>I think that everything is clear.</p>