[SLUG] Which exec* function to use?

From: Paul M Foster (paulf@quillandmouse.com)
Date: Sat Nov 30 2002 - 12:44:38 EST


This is for all you programmers out there. I have a C++ program that
does some preparatory tasks. Then I'd like it to call another program
which would execute another task, and return, then exit. Like this:

int main(int argc, char *argv[])
{
        do_some_stuff();
        do_another_program();
        return 0;
}

The question is what system function to use to launch that secondary
program. The fork() function doesn't allow me to pass a program name for
it to execute. The exec*() functions don't return unless there's an
error. I want a function that shares the majority of the parent's
environment and will search for executables, do its business, and then
return to the calling program. Anyone know what the name of this beast
is?

Paul



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:15:26 EDT