/* execl.c - run the ls command from a C program using execl * 2009.09.23 Neal Nelson * Copied from Haviland & Salama, p91 * */ #include #include #include main() { printf("Executing ls -lt using execl ...\n"); execl("/bin/ls", "ls", "-lt", (char *) NULL); /* If execl returns, the call has failed */ perror("execl failed to run ls"); exit(1); }