Solved pass variable inside of double quote for use in QProcess
-
Hi i now its not a good question but i cant find anyway to do this
i have this code for extract a file in Temp folder from Qt resourceQFile PAKList(":/test/list.txt"); QTemporaryFile *NewTempFile = QTemporaryFile::createNativeFile(PAKList); QString arg = NewTempFile->fileName();
i want to use
arg
inside QProcess as a argument of a extrnal program, problem is, its possible some user have space in there username, so thearg
is look like this when a space is in file locationC:/Users/user test/AppData/Local/Temp/File-X.cjDgQO
and as you know cmd program doesnt allow space in file address, so i want to add double quote to arg, but i dont know how can i do this job in a variable.
anyone can help -
how can i Put arg into double quote
"-list=\"" + arg + "\""
Whether this will do what your exe expects I don't know.
-
I don't see a problem when using QProcess here.
-
@Christian-Ehrlicher said in pass variable inside of double quote for use in QProcess:
I don't see a problem when using QProcess here.
QProcess BigPAKC; BigPAKC.start("some.exe", QStringList() << "d:/output/out.file" << "-list=" + arg << "-compress");
this code work when there is no space in
arg
, but when there is its not work, so i need to add "" toarg
-
any help?
how can i Put arg into double quote -
how can i Put arg into double quote
"-list=\"" + arg + "\""
Whether this will do what your exe expects I don't know.