Suppose we have two programs, A and B. B prints something continuously and reads input too. (probably there are two processes in B using same I/O, I don’t know if it is possible or not…)
A have to read B‘s output and decide about what to say to B, then sends a string to B‘s input. (just like that someone inputs text by keyboard to B).
I know that B uses std::cout to send messages to output and uses std::cin for read input.
How can I write A using C++ and standard library? Is this related to sockets or ipc?
Note: I’m using a i386 Linux system.
You can use the unofficial boost Process library, which has an excellent tutorial of exactly what you want to do and is bound to be an official part of boost any time now. It’s also naturally cross-platform. HTH