I am developing a C++ application, under Ubuntu, and need to broadcast the outputs into several terminals. I need to do this programmatically, calling (for instance) bash commands from the C++ application and directing the output to the corresponding terminal. And I cannot install any "multi-terminal" already developed tool (like "terminator", or others); instead, I need to use standard bash commands.
So:
process A -> will show its output in terminal A.
process B -> will show its output in terminal B.
process C -> will show its output in terminal C.
Note, then:
- I will be broadcasting to several terminal simultaneously, different information, and specific information, to specific terminal.
- Have you ever seen aircrack working? I remembered that app showing three different terminals at once, each one positioned at specific x,y coordinates of the screen, and each of them showing different information. Well, I think that is what I need.
Browsing, I have found the following "gnome-terminal" command, and I adapted it to run 3 terminals:
gnome-terminal --geometry=45x20+10+10; gnome-terminal --geometry=45x20+505+10; gnome-terminal --geometry=45x20+950+10
Some details:
- the terminals do not need to be gnome ones. They can be just simple consoles, xterms; whichever Ubuntu provides by default.
- I do not need to start the three terminals at once (as the above sample command). But, when the corresponding process needs to broadcast to its terminal, the terminal must be open.
- How will the program know to which terminal broadcast the output? May be using the pid of the terminal? If affirmative, having the terminal pid, how I would be redirecting the output to that terminal?
I was trying to get the pid of each terminal; for instance, like this:
gnome-terminal --geometry=45x20+10+10 &
and looking for some way to redirect the pid to a variable (do not find yet...).
gnome-terminal
all the terminal windows/tabs are handled by a single process (single pid).