child process

This is a discussion on child process within the C Programming forums, part of the General Programming Boards category; I have a child process running in the background it is created from the main program with the command system("./habbit&"); ...

  1. #1
    Unregistered
    Guest

    Lightbulb child process

    I have a child process running in the background it is created from the main program with the command

    system("./habbit&");

    How do I kill the child process without killing the main program?
    Is there a command for doing this or some function?

    If I use the fork command it freezes the main program.

    Thanks...

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

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

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,452

  4. #4
    Unregistered
    Guest
    ok I use kill, but I cannot retrieve the child PID from within the main program to kill the child process. Therefore if I kil anything it will kill the main program and the child program. I am using a unix platform. help.

    Thanks

  5. #5
    Unregistered
    Guest

    Cool

    Ok I don't know why i did not think of this eariler. But, I just placed an "getpid" in the child program and returned it to temp file, then I read it into the main program and finally used a keyboard command to execute the kill for the child. Now I can start and kill a child process at will thanks guys.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. init adopts zombie process?
    By password636 in forum Linux Programming
    Replies: 4
    Last Post: 07-01-2009, 10:05 AM
  2. inter process communcation, parent - child
    By tallan in forum C Programming
    Replies: 5
    Last Post: 02-28-2009, 03:04 AM
  3. create a child process that creates a child process
    By cus in forum Linux Programming
    Replies: 9
    Last Post: 01-13-2009, 01:14 PM
  4. Replies: 3
    Last Post: 10-15-2008, 09:24 AM
  5. process programming
    By St0rM-MaN in forum Linux Programming
    Replies: 2
    Last Post: 09-15-2007, 07:53 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21