I have a similar program(see below), and I do add "config += console" for qmake. but I can only get the first output but not the second output. Does anyone can help me?
Mingw 3.4.5 + Windows Vista Home
#include <QProcess>
#include <QString>
#include <QByteArray>
#include <QTextStream>
#include <QDebug>
int main(int argc, char** argv){
out<<"[result]"<<endl<<flush;
qDebug()<<"debug output"<<endl;
p->start("dir");
if (!p->waitForFinished())
return -1;
b=p->readAll();
out<<QString(b)<<endl;
qDebug()<<QString(b);
out<<"[end]"<<endl;
qDebug()<<"debug end";
return 0;
}
#include <QProcess>
#include <QString>
#include <QByteArray>
#include <QTextStream>
#include <QDebug>
int main(int argc, char** argv){
QTextStream out(stdout);
out<<"[result]"<<endl<<flush;
qDebug()<<"debug output"<<endl;
QProcess* p;
p=new QProcess();
p->start("dir");
if (!p->waitForFinished())
return -1;
QByteArray b;
b=p->readAll();
out<<QString(b)<<endl;
qDebug()<<QString(b);
out<<"[end]"<<endl;
qDebug()<<"debug end";
return 0;
}
To copy to clipboard, switch view to plain text mode
Bookmarks