I need basic logic for pipes. I know how to use pipes in the same cpp but I need to do something like; I have to create 2 .cpp files. One of them is parent the other one is child. parent will send whatever is in the buffer to child.cpp and will receive a response from child.cpp. child.cpp receives msg from it is parent and return to this msg back to its parent. I can do this in the same .cpp but I dont know how to communicate and implement this into 2 .cpp. any idea please?
Asked
Active
Viewed 270 times
0
-
1I think the question is garbled. A ".cpp" is C++ module, or a source file. Separate source files are just a way of dividing up classes and functions and other global declarations for the sake of organization. In no way do they map to separate processes. When two or more source files are linked into an executable and run, all functions run in the *same* process until you explicitly fork() somewhere. Do you have *separate* executables? – BaseZen Mar 01 '15 at 07:35
1 Answers
1
I think what you are expecting to do is establish piped ipc between two different processes. You can look at mkfifo for creating "named pipes".
Have a look at the following SO question for more insights