How to call an external program and get it from another program

How to do it in C ++:

Suppose a program Ais a command-line tool with some inputs (for example, file paths and a number), according to its input, it can receive some other parameters at runtime. ( if(condithin) cin<<something) I would call Afrom another program Band want to see the full output Aduring its operation. Input Amust be entered (if necessary). Bis a gui tool written with Qt and Ashould be displayed in the plaintext area, and its inputs should be displayed in one place (for example, the console client).

I just don't know where to start. Reading something about IPC did not help. I know this is possible because I see the Dolphin console window and the python interpreter in Eric IDE ...

+3
source share
2 answers

Since you are using Qt, using QProcess is probably the best way to do this.

+5
source

use QProcess :: execute to start A. start. you can generate an argument list from B to go to A. Use QProcess :: readAllStandardOutput () to read the output of the process and display in B.

+7
source

Source: https://habr.com/ru/post/1787666/


All Articles