I just had a basic question about forks. I'm writing an app that needs to fork
off three children and I need to distinguish between the children with wait().
Can anyone help?
ex of what I tried to get to work...
pid1 = fork(); /1st child
pid2 = fork(); /2nd child
pid3 = fork(); /3rd child
if (pid1 != 0 )
{ /* Paren't block of code */}
else if (pid1 = 0)
{ /* 1st child's block of code */}
else if (pid2 = 0)
{ /* 2nd child's block of code */}
else
{ /* 3rd child's block of code */}
just to keep it short... results are the parent block of code is run and then
the else statement is run... It doesn't like it when i try to determine the
child in an else if statement or an if statement like i have... Any ideas?
Thanks in advance,
Chris Blazek