title: C++ Find file name before file extension
body: <p>I am new to C++ and learning curve has taught me a lot already, but now I really need to find a way to this quickly, and neatly.</p>
  <p>I tried many ways, but can't figure it out (or it works; but partially).</p>
  <pre><code>size_t found = strFullPathName.find(&quot;.file001&quot;);
  
  if (found != string::npos)
  {
      //Find us the filename, and return in correct format.
      strFullPathName = strFullPathName.substr(0, strFullPathName.find(&quot;.file001&quot;));
      strFullPathName = szCurDir + &quot;\\output\\&quot; + strFullPathName + &quot;.file001&quot;;
  }
  </code></pre>
  <p>The above code, gives me <em>anything</em> before the <em>.file001</em> extension.</p>
  <p>But what I want in reality is just a way to fetch the <strong>filename</strong>.</p>
  <p>This could be with or without extension, preferred without.</p>
  <p>This can be done numerous ways, I'm sure. but i cant seem to find a easy and quick way to do it.</p>
  <p>Thank you in advance for helping me out.</p>