Thread: simple frontend program problem

  1. #16
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,661
    Well yes, if you dont do an exec, then the child process is going to go on running as another copy of your parent process, at whatever point the if()else around the fork() call merges back into being one execution path.

    exec() calls should be followed by an _exit() call, just to catch the case if an exec() should fail.
    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.

  2. #17
    Registered User gandalf_bar's Avatar
    Join Date
    Oct 2003
    Posts
    92
    Quote Originally Posted by Salem
    Well yes, if you dont do an exec, then the child process is going to go on running as another copy of your parent process, at whatever point the if()else around the fork() call merges back into being one execution path.

    exec() calls should be followed by an _exit() call, just to catch the case if an exec() should fail.
    Why _exit() not return? I think their effects for parent program are same.
    A man asked, "Who are you?"
    Buddha answered, "I am awaked."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Running Program Problem
    By warfang in forum C++ Programming
    Replies: 10
    Last Post: 03-28-2007, 02:02 PM
  2. simple login program problem
    By suckss in forum C Programming
    Replies: 11
    Last Post: 11-11-2006, 05:02 PM
  3. Problem with a simple program
    By Salgat in forum C Programming
    Replies: 10
    Last Post: 06-15-2006, 05:57 PM
  4. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  5. fopen();
    By GanglyLamb in forum C Programming
    Replies: 8
    Last Post: 11-03-2002, 12:39 PM