Created
April 19, 2017 02:19
-
-
Save Nalinh/aac497fa95dcf38c9cddffd6f3549a56 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "mainwindow.h" | |
#include "ui_mainwindow.h" | |
#include <QProcess> | |
MainWindow::MainWindow(QWidget *parent) : | |
QMainWindow(parent), | |
ui(new Ui::MainWindow) | |
{ | |
ui->setupUi(this); | |
} | |
MainWindow::~MainWindow() | |
{ | |
delete ui; | |
} | |
void MainWindow::on_pushButton_2_clicked() | |
{ | |
QProcess process; | |
//QString comd = "/bin/bash"; | |
//QStringList args; | |
//args<<"-c"<<"./untitled/SR.bash"; | |
// process.start("echo", QStringList() << "Xin Chao"); | |
//process.start("/bin/bash", QStringList()<< "-c" << QString ("SR.bash")); | |
//process.start(comd,args,QIODevice::ReadWrite); | |
process.start("/bin/bash /home/pi/untitled/SR.bash"); | |
process.waitForStarted(-1); | |
process.waitForFinished(-1); | |
QString stdOut = process.readAllStandardOutput(); | |
QString stdError = process.readAllStandardError(); | |
ui->stdoutText_2->append(stdOut); | |
ui->stderrText_2->append(stdError); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment