It’s hard to say, but have you tried that:
Filename is a
std::string::c_str() converts it to a
const char*, which is maybe what needs your
rename function as second argument?
If you are trying to use standard rename function, this may solve your problem.