#include <stdio.h>
#include <unistd.h>     /* for chdir and execvp */

/* Another exec example code - this uses an array of arguments 
   (uses execvp instead of execlp)
*/

int main() {
  /* define array of string we will pass to execvp (which become
     argv in the new program) */
  char *args[] = { "ls", "-al" ,	NULL };

  /* change current working directory to / */
  chdir("/");

  /* run ls -al using execvp */
  if (execvp(args[0],args)) {
	perror("Huh?");
  }
  return(0);  /* only gets here is execvp failed! */
}


