Works fine for me. But why are you copying from a
string
to a
char
array? All you need is:
fs.open(str);
Also the
str.c_str()
will handle all characters in the ASCII set: alpha, numeric, special etc. So, whatever problem you are seeing is not clear from the above code.