c++ - Replace single quote in QFile file name -


i want open file contains single quote can't open it.

file name example : qfile file("my'file.example")

i've tried file.filename().replace("\'", "\\\'") it's same result.

you trying replace "\'" not on original string not work. furthermore, qfile::filename return copy of filename property, , modification (like replace) made on copy. play filename (before open), use

file.setfilename(file.filename().mymodificationoperation()) 

have tried qfile file("my\'file.example")?

to test parameter use static call:

qstring filename = "my\'file.example"; bool okay = qfile::exists(filename); 

Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -