Qt-interest Archive, August 2006
QProcess corrupts my arguments on Windows (Qt 4.1.3)
Message 1 in thread
I am trying to launch another process through QProcess with an argument that
should look like:
/DIR="M:\some dir\"
The documentation for QProcess::start() states that on Windows, quotes have
to be escaped 3 times. I did this, and still, Qt converts the argument to:
/DIR=\"M:\some dir\\\"
before passing it to CreateProcessW. I found this out through stepping
through the Qt source after calling start(). This confuses the receiving
program.
My code looks something like:
QString path = "c:/prog.exe";
path += " /DIR=\"\"\"" + GetDir() + "\"\"\"";
QProcess proc(this);
proc.start(path);
Inside QProcessPrivate::startProcess, there is a call to
qt_create_commandline that adds the extra back slashes. Why is it doing this
and what do I need to change to get the expected behaviour?
Thanks,
Erik
--
[ signature omitted ]