execlp()                 Execute Program Using Argument List and Path
 
 #include   <process.h>
 
 execlp(pathname, arg0,arg1...,argn,NULL);
 
 char       *pathname;                   Path name of file to be executed
 char       *arg0,*arg1...,*argn;        List of pointers to arguments
 
    execlp() operates identically to execl(), with one exception:  If
    'pathname' is not found as described in execl(), then execlp() will
    use the DOS PATH to continue the search for pathname.  With that
    single exception, the two functions are identical; see execl() for a
    complete description.
 
  -------------------------------- Example ---------------------------------
 
    The following statements transfer execution to the child process
    "child", and pass it the three arguments "CHILD", "arg1", and "arg2".
    "child" or "child.exe" can be in the current directory, or any PATH
    directory:
 
            #include <process.h>    /* for 'execlp' */
            #include <stdio.h>      /* for 'printf' and 'NULL' */
            #include <stdlib.h>     /* for 'errno' */
            #include <errno.h>      /* for 'ENOENT' and 'ENOMEM' */
 
            main()
            {
                execlp("child", "CHILD", "arg1", "arg2", NULL);
                /* only get here on an exec error */
                if (errno == ENOENT) {
                    printf("neither child nor child.exe found in current\n");
                    printf("  directory, or in any PATH directory\n");
                } else if (errno == ENOMEM)
                    printf("not enough memory to execute child\n");
                else
                    printf("error #%d trying to exec child\n", errno);
             }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster