Qt 获得终端执行结果

代码

话不多直接上本人代码

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

效果

原文地址:https://www.cnblogs.com/sollyu/p/3680245.html