Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>exec...(pathname, arg-list | arg-arrayl [,envp])</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
exec...(pathname, arg-list | arg-arrayl [,envp])

    The exec...() functions load and execute a new program, known as a
    child process.  The child process is placed in the memory currently
    occupied by the calling program.  There must be sufficient memory to
    load and execute the child process.

    All eight of the exec...() functions perform the same operation; they
    differ only in how arguments are passed, the use of the DOS PATH in
    searching for the program to be run ('pathname'), and the use of the
    DOS environment. The eight functions offer various combinations of
    argument passing, use of the DOS PATH, and the environment:

                  Arguments to Child                         Passes New
                     Passed As            Searches DOS       Environment
    Function       List    Array         PATH for Child        String

    execl()         .
    execle()        .                                             .
    execlp()        .                          .
    execlpe()       .                          .                  .
    execv()                  .
    execve()                 .                                    .
    execvp()                 .                 .
    execvpe()                .                 .                  .


  Arguments:    Arguments are passed to the new process by including one
                or more pointers to character strings in the exec() call.
                The character strings can be passed either as a list of
                separate arguments, or as an array of pointers. Exec
                functions with an 'l' in their name use the list method;
                functions with a 'v' pass an array of pointers:

                The exec functions that use a list to pass arguments to
                the child process are usually used when the number of
                arguments is known in advance. In this case, the first
                argument in the list is by convention a pointer to
                'pathname', while the remaining arguments in the list
                point to character strings that constitute the argument
                list of the child process. The last pointer must be NULL,
                to mark the end of the list.

                The exec functions that use an array of pointers to pass
                arguments to the child process are used when the number of
                arguments is not known in advance. The first pointer in
                the array usually points to 'pathname', and the last must
                be a NULL pointer.

       PATH:    The exec functions with a 'p' in their name search for
                'pathname' using the DOS PATH environment variable.

Environment:    Four of the exec functions--execl, execlp, execv, and
                execvp--allow the child process to inherit the calling
                program's environment. The other four functions--those
                with an 'e' at the end of their name (execle, execlpe,
                execve, and execvpe)--allow the calling program to alter
                the called program's environment by passing a list of
                environment settings in the envp argument.

    For details on using the exec() functions, see the entry for the
    particular function you're interested in.

      Notes:    The exec functions are a special case of the more general
                spawn...() functions. The spawn functions include an
                additional argument, 'modeflag', that determines whether
                the calling (parent) program will be suspended while the
                child is running, executed concurrently, or overlaid. The
                last option (overlaid) is equivalent to the exec function.
                See the spawn functions for additional details.

See Also: execl() execle() execv() execve() spawn...()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson