title: Windows fnmatch substitute
body: <p>I have the following code in Linux that looks for files that matches the given wildcard:</p>
  
  <pre><code>    std::vector&lt;std::string&gt; listFilenamesInPath(std::string wildcard = "*", std::string directory = "./")
      {
          std::vector&lt;std::string&gt; result;
          DIR* dirp = opendir(directory.c_str());
  
          if (dirp)
          {
              while (true)
              {
                  struct dirent* de = readdir(dirp);
  
                  if (de == NULL)
                      break;
  
                  if (fnmatch(wildcard.c_str(), de-&gt;d_name, 0))
                      continue;
                  else
                      result.push_back (std::string(de-&gt;d_name));
              }
  
              closedir(dirp);
          }
  
          std::sort(result.begin(), result.end());
  
          return result;
      }
  </code></pre>
  
  <p>I´m porting this code to Windows and found out that <code>fnmatch</code> is not available  (<code>dirent</code> is also not available, but I could find one according to the following <a href="https://stackoverflow.com/questions/5530933/dirent-h-in-visual-studio-2010-or-2008">SO link</a>.</p>
  
  <p>Is there a fnmatch substitute function that does exactly the same thing ?</p>
  
  <p>How can I make this code compile and run in a VS2012 without breaking up my logic ?</p>