How to wab for all chilren *processes* to return?

L

loudking

Question : write a program which creates 5 processes (in addition to
itself). One of these processes must display 1, another must display 2
.... the last one displays 5. The parent process waits until all other
processes are finished, then returned.
 
T

Tor Rustad

loudking said:
Question : write a program which creates 5 processes (in addition to
itself). One of these processes must display 1, another must display 2
... the last one displays 5. The parent process waits until all other
processes are finished, then returned.

Howto contact your teacher?
 
F

Francine.Neary

Question : write a program which creates 5 processes (in addition to
itself). One of these processes must display 1, another must display 2
... the last one displays 5. The parent process waits until all other
processes are finished, then returned.

However often you ask this, it still won't be on topic here.
 
A

Army1987

loudking said:
Question : write a program which creates 5 processes (in addition to
itself). One of these processes must display 1, another must display 2
... the last one displays 5. The parent process waits until all other
processes are finished, then returned.

The thing closest to a portable C way to do that, is displaying argv[1][0]
and flushing stdout if argv[1] is not NULL, and writing some code to copy
argv[0] to a string, append " 1" to it, pass it to system() etc. if argv[1]
is NULL.
But nothing in the Standard requires this to work. The behaviour of system()
and the exact contents of argv[0] are implementation defined.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top