Thread: child spawning

  1. #1
    Registered User
    Join Date
    Aug 2004
    Posts
    36

    child spawning

    hi there,
    i need some help with executing a file from within a program....
    how do i spawn two child programs concurrently from the parent program and after spawning the child programs the parent program exits(.i.e it gives birth to two child programs and dies)
    i saw the faq section and found out "spawn" commands but the thing is it based on windows and i am in linux....and also it doesnt mention about the parent exiting after spawning the childs
    any help will be greatly appreciated
    thanx

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    man fork


    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    Registered User
    Join Date
    Aug 2004
    Posts
    36
    how to spawn 2 process simultaneously with fork?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    call fork twice of course.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User
    Join Date
    Aug 2004
    Posts
    36
    the thing is i have a program(main) that needs to execute 2 programs(child) whose outputs are dependent on each other....

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    So basically, you also want to arrange a pipe between them as well, so you end up with something like

    producer | consumer

    Both are children of your process, and one sends info to the other
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 02:14 PM
  2. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  3. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM
  4. Child window inside child window
    By Magos in forum Windows Programming
    Replies: 13
    Last Post: 04-20-2004, 06:51 AM
  5. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 09:44 AM