Ok, I still am doing something wrong, but I took the advice both of you presented me. When I click my button, which invokes my command-line based program, it does the following:
QString program
= "/home/bgarrison/code/myUtils";
connect (myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
connect (myProcess, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
myProcess->start(program, arguments);
myProcess->waitForFinished();
QString program = "/home/bgarrison/code/myUtils";
QStringList arguments;
myProcess = new QProcess(this);
connect (myProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(printOutput()));
connect (myProcess, SIGNAL(readyReadStandardError()), this, SLOT(printError()));
myProcess->start(program, arguments);
myProcess->waitForFinished();
To copy to clipboard, switch view to plain text mode
printOutput() is a private SLOT in my class and it does the following:
void cMyUtils::printOutput()
{
ui->e_Log->append("Got to printOutput()"); // TextEdit to see results
QByteArray byteArray
= myProcess
->readAllStandardOutput
();
ui->e_Log->append(line);
}
}
void cMyUtils::printOutput()
{
ui->e_Log->append("Got to printOutput()"); // TextEdit to see results
QByteArray byteArray = myProcess->readAllStandardOutput();
QStringList strLines = QString(byteArray).split("\n");
foreach (QString line, strLines){
ui->e_Log->append(line);
}
}
To copy to clipboard, switch view to plain text mode
void Dialog_FileSplitter::printError()
{
ui->e_Log->append("Got to printError()");
QByteArray byteArray
= myProcess
->readAllStandardError
();
ui->e_Log->append(line);
}
}
void Dialog_FileSplitter::printError()
{
ui->e_Log->append("Got to printError()");
QByteArray byteArray = myProcess->readAllStandardError();
QStringList strLines = QString(byteArray).split("\n");
foreach (QString line, strLines){
ui->e_Log->append(line);
}
}
To copy to clipboard, switch view to plain text mode
This resulted in me being able to see why the program was not starting :)
Got to printError()
/home/bgarrison/code/myUtils: error while loading shared libraries: libboost_regex.so.1.41.0: cannot open shared object file: No such file or directory
Looks like I have a problem linking the Boost libraries, not calling the program using QProcess. Thanks for all of your help!
Bookmarks