in reply to Receiving data from many children

You can open a pipe before you start spawning the children. Each child closes the read side of the pipe, and prints data to the write side. The parent reads from the pipe, which has become shared among the kids by duplication of the handle.

I published a similar example here at Many-to-One pipe. There, however, I had one child collecting the data from the others. You can adapt that to your requirements.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Receiving data from many children
by xiper (Friar) on Aug 20, 2003 at 04:21 UTC
    Hmm, i tried experimenting with pipes before i posted but couldn't get them to work... Just tried again, copying your example, and *tada*, works! Finally figured out that in my first attempt i had the reader/writer mixed up in the initial pipe... *slaps self*

    Future readers, the end result: