I need a way to communicate with other exe's. Almost like being able to call cout but to a exe, not the output stream. Both of the apps would be in c++. I know cout is for output stream, sstream is for any stream, fstream is for files, something like those, but for exe's. Basically they need to communicate. Thanks in advance.

Linux has the concept of pipes to communicate between executables. Since you are saying "exes" I'm assuming you're in Windows, in which case I have no idea. You could always write to a file from program A and then read the file from program B, the problem would then be how do you notify program B that the file has been changed?

Windows also knows the concept of pipes (see CreatePipe on MSDN), although throughput is lower than on Linux. Chances are it's still fast enough for what you're trying to do, though.

thanks for all the replies, but I found that in command prompt I can use | to pipe the output of one to the input of another

Okay well I have a problem with what I suggested earlier. I can use "|" to put the output to another process, but my program is a continuous stream of input/output. Also, if needed, I can use linux. To explain more, I'm doing a battleship competition where the host calls commands like "fire" to my program, and my program will produce a coordinate like "A6", the host will then send the command "hits" and then 0 for a miss or a number 1-5 representing the 5 ships. the program can't be restarted every time new input is given, so I need to get it so that everything coming out of a host will be forwarded to my program. I want to make my own host to just test things out. I emailed the person running it for how they did it but they haven't replied for a week and I don't think they will

I'm not sure how correct this solution is, but if you have access to the source code for both programs, you could use network sockets. Simply make one program act as a server and the other as client. Then you can use either TCP or UDP to send messages to a port on the local computer (localhost), which then would be received by the other program.

I have earlier used this method to implement communicate between programs on the same computer. But again i don't know if this is a "correct" solution, so please correct me if I'm wrong

This article has been dead for over six months. Start a new discussion instead.