if (fileName.find('-')) {
replace(fileName.begin(), fileName.end(), '-', '_');
}
So far so good, but a subsequent call to a function only fails when the replace does happen, but works if the replace does not get executed. So obviously replace is doing something I am not aware of. How do I keep c_str() happy?
:
int Parse( filename.cstr() ); // parse will fail when trying to open filename.
http://ideone.com/4u5lq , so the code is fine.
The problem must be elsewhere. By the way, find returns the position of the first '-' or string::npos, not true or false, so replace is not called only if fileName starts with '-'.
Why are you constructing an int Parse from a const char* ?