multiple qprocess arguments
I am invoking a linux system process using QProcess. The process works, but when I supply more arguments than the three prescribed arguments it gives an error.
sox.start("sox", infile.wav -c 1 outfile.wav remix 0 1);
How can I make it accept my last argument "remix 0 1"?
Code:
#include <QtGui>
#include <QApplication>
int main(int argc, char* argv[])
{
QProcess sox;
//instantiate the process**** args1 << "infile.wav"; //collect arguments to be envoked with qprocess
args1 << "-c 1"; //collect arguments to be envoked with qprocess
args1 << "outfile.wav"; //collect arguments to be envoked with qprocess
//args1 << "remix 0 1"; //collect arguments to be envoked with qprocess
sox.start("sox", args1); //pass qprocess and arguments to start method
while(sox.waitForReadyRead())
output += sox.readAll();
qDebug() << "sox" << args1;
}
Re: multiple qprocess arguments
What it is "it gives an error" ? What error ?
Re: multiple qprocess arguments
Are you sure that "remix 0 1" is a single argument?
Would you pass that quoted on the shell?
My guess is that these are actually three arguments
Code:
args1 << "infile.wav";
args1 << "-c";
args1 << "1";
args1 << "outfile.wav";
args1 << "remix";
args1 << "0";
args1 << "1";
or
Code:
args1 << "infile.wav" << "-c" << "1" << "outfile.wav" << "remixe" << "0" << "1";
Rule of thumb: any space on the commandline starts a new argument, unless it is escaped or quoted.
Cheers,
_
Re: multiple qprocess arguments
apologies for not posting correctly.
When the system process is called by QProcess it does not produce any result, however when it is entered on a terminal it works. Here is the complete command:
sox infile.wav -c 1 outfile.wav remix 0 1
Re: multiple qprocess arguments
As anda_skoa said : You have 7 args not 3.