I am trying to delete a .txt file, but the file name is stored in a variable of type std::string . The fact is that the program does not know the file name in advance, so I canโt just use remove("filename.txt");
string fileName2 = "loInt" + fileNumber + ".txt";
Basically what I want to do:
remove(fileName2);
However, he tells me that I cannot use this because it gives me an error:
There is no suitable conversion function from "std :: string" to "const char *".
source share