How do i redirect code from terminal to a drawing app? How do i redirect code from terminal to a drawing app? unix unix

How do i redirect code from terminal to a drawing app?


fork() and execlp() with "java -jar drawapp.jar"


So as far as I understand, your program's stdout is piped to the java-process. Now you first want to communicate with the user using the terminal-window, and then send commands via stdout to the java.process.So you could just open /dev/tty for output

FILE *f=fopen ("/dev/tty", "w");fprintf (f, "Hi there\n");

and talk this way to the terminal. If you have output with no \n at the end, you might have to use fflush:

fprintf (f, "enter name: ");fflush (f);