I have 2 processes. I need proces1 to show what's also shown in process2.
I use c/c++ in Windows and the processes are console application.
I guess will use pipe. But how?
What do you mean "also show?" I assume process1 writes to stdout and process2 somehow needs access to that output? So you'd run the two programs like this: process1 | process2
. In which case you just need to use std::cout
in process1 and std::cin
in process2 to do the reading (and possibly also write using std::cout
again if you want the output of process1 to be visible in the terminal).
精彩评论