Hi,

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.

Qt Code:
  1. #include <QProcess>
  2. #include <iostream>
  3. #include <QtCore>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8.  
  9. QProcess *gzip = new QProcess(0);
  10. gzip->start("rsh -l usr 192.168.20.1 rcp /home/usr/0.txt usr2@192.168.20.2:/home/usr2/rsh/");
  11. if (!gzip->waitForStarted())
  12. return false;
  13.  
  14. gzip->closeWriteChannel();
  15.  
  16. if (!gzip->waitForFinished())
  17. return false;
  18.  
  19. QByteArray result = gzip->readAllStandardError();
  20. cout << QString(result).toStdString() << endl;
  21.  
  22. if(gzip) delete gzip;
  23. }
To copy to clipboard, switch view to plain text mode 

thanks