The validity of the output of c_str()
is limited to, at most, the lifetime of the object on which c_str()
was called.1
I suspect that this->IOPaths.rawData
is pointing to deallocated memory once filenameRaw
is out of scope.
An adequate remedy would be to pass the std::string around rather than [const] char*
. A good stl implementation would use copy on write semantics for the string class so perhaps you wouldn't be repeatedly copying string data.
1In certain instances (such as if the object is modified), it could be less.