View Full Version : QProcess question

4th June 2010, 12:38

I was trying out QProcess to send console commands and get what it returns. I tried to send a valid rsh command with an invalid address to see if QProcess returns me any error msg but it doesn't... not sure what i have done wrong. Below are the code i test with...modified from the qt qprocess example.

#include <QProcess>
#include <iostream>
#include <QtCore>

using namespace std;

int main(){

QProcess *gzip = new QProcess(0);
gzip->start("rsh -l usr rcp /home/usr/0.txt usr2@");
if (!gzip->waitForStarted())
return false;


if (!gzip->waitForFinished())
return false;

QByteArray result = gzip->readAllStandardError();
cout << QString(result).toStdString() << endl;

if(gzip) delete gzip;


4th June 2010, 13:10
Its upto the program running to set the error appropriately. Have a look at exitCode in QProcess to get this error code.