Click here to Skip to main content
15,884,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to share processes which is created by fork() in c++.
Posted
Updated 26-Feb-15 17:27pm
v2
Comments
CPallini 26-Feb-15 13:10pm    
What do you want to share?
[no name] 26-Feb-15 23:28pm    
variable value
[no name] 26-Feb-15 23:32pm    
For example ,
One process do the assign value to one variable,
second process do the assign value to second variable,
then i want to sum of them .

1 solution

You need to use some sort of IPC between the processes involved.
http://en.wikipedia.org/wiki/Inter-process_communication[^]

Every IPC type has positives and negatives, so read up on your options and implement one based on your research.

Edit: If your processes are simple and don't have to run concurrently, you can also pipe the output of one into another. That's the simple way of doing things. If they do have to run at the same time, you definitely need some sort of IPC.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900