bgarisn
24th February 2010, 23:35
Hello all,
First let me say that I've tried to look through these forums for an answer to my problem, but as of yet, have been unsuccessful, so here it goes.
I have a simple utility program that is command line based. I have been developing a GUI to get the required parameters and then pass them to the command line program when my "Process" button is clicked. Here is the code that is executed when the button is clicked:
QString program = "/home/bgarrison/code/myUtils";
QStringList arguments;
QProcess *myProcess = new QProcess(this);
myProcess->start(program, arguments);
myProcess->waitForFinished();
QString strOut = myProcess->readAllStandardOutput();
qDebug() << strOut;
If I run 'myUtils' with no arguments, I should get "This is a test." on std::out. However, my debug print prints ""...
I'm at a loss for why this is so.
I've tried the examples in the documentation:
QString program = "./path/to/Qt/examples/widgets/analogclock";
QStringList arguments;
arguments << "-style" << "motif";
QProcess *myProcess = new QProcess(this);
myProcess->start(program, arguments);
And it brings up the AnalogClock example just fine. I've even tried to call several of the other examples, which also worked.
Why can I not call my command-line based program?
Thanks for any and all advice.
First let me say that I've tried to look through these forums for an answer to my problem, but as of yet, have been unsuccessful, so here it goes.
I have a simple utility program that is command line based. I have been developing a GUI to get the required parameters and then pass them to the command line program when my "Process" button is clicked. Here is the code that is executed when the button is clicked:
QString program = "/home/bgarrison/code/myUtils";
QStringList arguments;
QProcess *myProcess = new QProcess(this);
myProcess->start(program, arguments);
myProcess->waitForFinished();
QString strOut = myProcess->readAllStandardOutput();
qDebug() << strOut;
If I run 'myUtils' with no arguments, I should get "This is a test." on std::out. However, my debug print prints ""...
I'm at a loss for why this is so.
I've tried the examples in the documentation:
QString program = "./path/to/Qt/examples/widgets/analogclock";
QStringList arguments;
arguments << "-style" << "motif";
QProcess *myProcess = new QProcess(this);
myProcess->start(program, arguments);
And it brings up the AnalogClock example just fine. I've even tried to call several of the other examples, which also worked.
Why can I not call my command-line based program?
Thanks for any and all advice.