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