我的code:
m_process = new QProcess(this);
m_process->start("./for", QIODevice::ReadWrite);
m_process->setReadChannelMode(QProcess::MergedChannels);
connect (m_process, SIGNAL(readyReadStandardOutput()),
this, SLOT(showOutput()));
void MainWindow::showOutput() {
QString bytes = m_process->readAllStandardOutput();
textEdit->setText(tr("%1").arg(bytes));
}
for的code:
#include<iostream>
#include<stdlib.h>
using namespace std;
int main(){
for(int i=0;i<10000;i++){
for(int j=0;j<1000;j++)
if(i= =0&&j= =2)
cout<<i<<"\n";
}
cout<<"a";
return 0;
}
我無法先輸出0後,再等一段時間才輸出a,我程式是2個for都跑完才 輸出0跟a,
請問我的code要怎樣修改才能有辦法先輸出0輸出a