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>execlp() execute program using argument list and path</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 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.

 Portability:   Xenix, OS/2, or MS-DOS 3.0 or higher.

   ----------------------------- Example -------------------------------

    The following statements transfer execution to the child process
    "child", and pass it the three arguments "CHILD", "arg1", and "arg2".
    "child", "child.com",  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);
           }


See Also: execl() exec...()

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