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

    Like the exec...() functions, the eight spawn...() functions load and
    execute a new program, known as a child process.  There must be
    sufficient memory to load and execute the child process.

    The spawn family of functions differs from the exec family in only
    one particular: They have an additional argument, 'modeflag'.  This
    argument specifies whether the parent process will be suspended until
    the child process is complete,  be overlaid in memory by the child
    process (thereby destroying the parent, same effect as exec...()
    calls); run concurrently with the child (valid only in OS/2 protected
    mode); or continue to execute, ignoring wait() and cwait() calls
    against the child process (valid only in OS/2 protected mode).

    All eight of the spawn 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
    ----------   ------------------      --------------      -----------
    spawnl()         .
    spawnle()        .                                             .
    spawnlp()        .                          .
    spawnlpe()       .                          .                  .
    spawnv()                  .
    spawnve()                 .                                    .
    spawnvp()                 .                 .
    spawnvpe()                .                 .                  .


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

                The spawn 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 spawn 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.

                In MS-DOS or OS/2 real mode the combined length of the
                strings forming the argument list for the child process
                must not exceed 128 bytes (the terminating null character
                '\0' for each string is not included in the count, but
                space characters that are automatically inserted to
                separate arguments are included).

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

 Environment:   Four of the spawn functions--spawnl, spawnlp, spawnv, and
                spawnvp--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 (spawnle, spawnlpe,
                spawnve, and spawnvpe)--allow the calling program to pass
                a list of environment settings in the 'envp' argument and
                thus alter the called program's environment. The argument
                'envp' is an array of character pointers, each element of
                which (except for the last) points to a null-terminated
                string defining an environment variable. These strings
                typically have the form NAME=value, where NAME is the
                name of an environment variable, and value is the string
                value to which that variable is set (note that quotes are
                not used around value).

                Files that are open when the spawn call is made remain
                open in the child process.

 Portability:   Applies to MS DOS only.

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



See Also: spawnl() spawnle() spawnv() spawnve() exec...()

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