Did you check the argument for std::ofstream
constructor? I think it is a const char *
.
The constructors are declared as
explicit ofstream (const char* filename, ios_base::openmode mode = ios_base::out);
So in your case, you use a std::string
as the argument, it should be
std::ofstream writer(filelocation.c_str());