title: Easy way to remove extension from a filename?
body: <p>I am trying to grab the raw filename without the extension from the filename passed in arguments:</p>
  
  <pre><code>int main ( int argc, char *argv[] )
  {
      // Check to make sure there is a single argument
      if ( argc != 2 )
      {
          cout&lt;&lt;"usage: "&lt;&lt; argv[0] &lt;&lt;" &lt;filename&gt;\n";
          return 1;
      }
  
      // Remove the extension if it was supplied from argv[1] -- pseudocode
      char* filename = removeExtension(argv[1]);
  
      cout &lt;&lt; filename;
  
  }
  </code></pre>
  
  <p>The filename should for example be "test" when I passed in "test.dat".</p>