I was just wondering if it is possible for one console-based program to send keyboard input to another console-based program. For example, is there any way to write to another process's stdin?
Printable View
I was just wondering if it is possible for one console-based program to send keyboard input to another console-based program. For example, is there any way to write to another process's stdin?
To both questions, the answer it yes, it is possible.
How is determined by the operating system.
On Windows, you can open a process via CreateProcess and at the same time redirected their standard input/output and in that way write data.
Another way is using the SendInput API.
Well YES, you can, you just need to pipe the inputed chars from Process1 to Process 2. The concept you should be looked at here is called pipes. There some system calls which you need to call. Strictly speaking this concept is called Inter Process Communication (IPC's). There are different methods of achieving it. Have look this tutorial. Inter Process Communication Concept
ssharish