代码
话不多直接上本人代码
void MainWindow::on_pushButton_3_clicked() { myprocess = new QProcess(this); myprocess->start("pwd"); myprocess->waitForFinished(); QString abc = myprocess->readAllStandardOutput(); QLibX::QMessageBoxEx::GetInstance()->information(this,"Title",abc); }
外加一个引用
http://stackoverflow.com/questions/11921004/cannot-read-output-using-readyreadstandardoutput-in-qt
效果