Answers for "c++ get file extension"

C++
0

c++ get file extension

#include <iostream>
#include <string>
using namespace std;

string GetFileExtension(string Filename)
{
   size_t LastDot = Filename.find_last_of(".");

   if (LastDot == string::npos)
   {
      return ""; // No extension in Filename string
   }

   return Filename.substr(LastDot);
}
Posted by: Guest on July-16-2021
0

what is c++ file extension

All C++ header extensions: .c , .h , .hpp , .hxx , .cpp , .hh
C++ file (items / source code): .cpp , .cc , .cxx
Posted by: Guest on February-08-2021

Browse Popular Code Answers by Language