How to get the text output from an ui program with the qprocess
-
I used the qprocess to start an external program which is an ui program.how to send the messages from the ui program to the qprocess executions?
//project a: int main(){ qDebug()<<"output"; } //project b: int main(){ qprocess pr; pr.called(a.exe); while(){ // how to get the output from the project a? } }
-
You can read the std out of
QProcess
for example with -
@nicker-player
Please read the QProcess documentation. You will seereadAllStandardError
/Output()
, which can be used to read anything the child process writes on stdout/err.You will also need to write a properly constructed Qt program. There will be no
while
loop. Either usewaitForFinished()
or enter the Qt event loop and use thereadyRead...
signals.NOTE: Whether what you call "an ui program" will actually write anything at all to stdout/err is a different matter. Command line program often do, but UI ones may not if all they do is present a UI to the user.
-
@JonB said in How to get the text output from an ui program with the qprocess:
NOTE: Whether what you call "an ui program" will actually write anything at all to stdout/err is a different matter.
I assumed that project "a" (the one running as
QProcess
) is @nicker-player 's own additional Qt GUI app :)//project a: int main(){ qDebug()<<"output"; }