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"?
#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;
}
#include <QtGui>
#include <QApplication>
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
QProcess sox; //instantiate the process****
QStringList args1; //declare arguments
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
QByteArray output; //understood by QString
while(sox.waitForReadyRead())
output += sox.readAll();
qDebug() << "sox" << args1;
}
To copy to clipboard, switch view to plain text mode
Bookmarks