I downvoted this reply because it doesn't answer the question. (It also demonstrates two useless uses of autoflush, but that's a different problem.)
The original code has two main problems: child processes don't exit and parent processes block on STDIN. You can certainly possibly avoid these errors by throwing away the example code and rewriting it according to a different concurrency model, but that really doesn't help the original poster learn anything forking.
In reply to Re: Re: To Fork for Not to Fork
by chromatic
in thread To Fork for Not to Fork
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |