获取标准输出

来源:互联网 发布:c语言截断字符串 编辑:程序博客网 时间:2024/05/17 04:59

来自stack overflow问答,原文地址:地址

void MainWindow::on_pushButton_24_clicked(){    myprocess = new QProcess(this);    connect(myprocess, SIGNAL(readyReadStandardOutput()),            this, SLOT(outlog()));    myprocess->start("./helloworld.exe");    // For debugging: Wait until the process has finished.    myprocess->waitForFinished();    qDebug() << "myprocess error code:" << myprocess->error();}void MainWindow::outlog(){    QString abc = myprocess->readAllStandardOutput();    emit outlogtext(abc);    lineEdit_4->setText(abc);}


原创粉丝点击