#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QProcess>
#include <QFile>
#include <QDebug>
#include <stdio.h>
int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
FILE* file1 = popen ("make", "r");
char buff[5122];
while(fgets(buff, sizeof(buff), file1)!=NULL)
{
qDebug() << "from here: " << buff;
}
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral ("qrc:/main.qml")));
return app.exec();
}
With make
command the output is:
QML debugging is enabled. Only use this in a safe environment.
from here: make: Nothing to be done for
first'.`
With ping
command the output is:
QML debugging is enabled. Only use this in a safe environment.
Usage: ping [-aAbBdDfhLnOqrRUvV] [-c count] [-i interval] [-I interface]
[-m mark] [-M pmtudisc_option] [-l preload] [-p pattern] [-Q tos]
[-s packetsize] [-S sndbuf] [-t ttl] [-T timestamp_option]
[-w deadline] [-W timeout] [hop1 ...] destination
As you can see, with make
command the output was trapped and displayed by qDebug
. But, this isn't the case with ping
.
Be it an error or whatever, I want every output to be trapped and displayed through qDebug through my program.
What am I supposed to do now?