C++ open new terminal and send commands

I am working on a project in which I am writing code in c++ that is used to open a new terminal window and run a second program in that window. So far I have:

void MoveFoward()
{
using namespace std;

system( "gnome-terminal --window" );

}

this opens a second terminal window, but how do I get the program to point to that second window to send commands in the format:

system( "stringcommand" );

Thanks
I don't think you're going about this in the right way - what exactly do you want?

Do you want the user to be able to interact with the console? If not, why do you even need to open it at all?
the program I want to run in the second terminal is designed to walk a robot using keyboard commands entered through the terminal.

I am writing a program to automate this using vision. So I want the first program to open a new terminal, run the walker program in the new terminal, and send keyboard commands based on the robot's vision to walk the robot with no user input. The vision part and opening the terminal I have figured out, I just dont know how to print keyboard commands to a different terminal.

for example, to tell the robot to walk forward, the user enters "i"

So in program 1, there would be a line:

system( "i" );

but this attempts the print char "i" in the terminal that the first program is running

I hope that makes sense....
How about program 1 prints to stdout, program 2 reads from stdin

program_1 | program_2
Again: You're going in the wrong way.
"System" is not what you want, for security and non-working reasons.
I meant, just use a pipe - no system calls required
Topic archived. No new replies allowed.