No suitable conversion function from "std::string" to "const char *" exists
remove(fileName2.c_str());
will do the trick.
The c_str()
member function of a std::string
gives you the const char *
C-style version of the string that you can use.
You need to change it to:
remove(fileName2.c_str());
c_str()
will return the string as a type const char *
.