Hi,
I need help for using QProcess.
I have to run a cmd like this:
cmd -param1 -param2 value2 -param3 value3:title="My Title with spaces"
cmd -param1 -param2 value2 -param3 value3:title="My Title with spaces"
To copy to clipboard, switch view to plain text mode
For param1 & param2 no problems; param3 dont'work.
My code is:
[...]
#include <qprocess.h>
int main (int argc, char **argv)
{
[...]
[...]
proc->addArgument ("cmd");
proc->addArgument ("-param1");
proc->addArgument ("-param2");
proc->addArgument ("value2");
proc->addArgument ("-param3");
QString myCmd
= "value3:title=\"My Title with spaces\"";
proc->addArgument (myCmd);
if (!proc->start())
{
// error handling
exit (-1);
}
return 0;
}
[...]
#include <qprocess.h>
int main (int argc, char **argv)
{
[...]
QApplication a (argc, argv);
QProcess *proc;
[...]
proc = new QProcess ();
proc->addArgument ("cmd");
proc->addArgument ("-param1");
proc->addArgument ("-param2");
proc->addArgument ("value2");
proc->addArgument ("-param3");
QString myCmd = "value3:title=\"My Title with spaces\"";
proc->addArgument (myCmd);
if (!proc->start())
{
// error handling
exit (-1);
}
return 0;
}
To copy to clipboard, switch view to plain text mode
When I launch this program I have no error but the third parameter is not correct. This arrives quoted. I think I have to avoid quoting...
I'm using Linux with bash shell.
Thanks for any help,
the_bis
Bookmarks