I know how to read and write if i have a forked process with only one child. However what is involved with reading and writing with many forked processes. Say one parent that forks 5 children, and needs to communicate with all 5 in half duplex.
int temp[2], counter=0;
do{
pipe(temp);
if(fork()>0){
//store values of temp in a 2 dimensional array then re-index the array @ counter.
}
counter++
}while(counter<5);
Then if i access each the 2 dimensional array at location array[0][1] i cold write to child 1, and read child 1 at array[0][0];
Is there an easier way?
Im gong to implement this shortly, please let me know if im on the right track.