I'm testing the execl()
function tho I'm not being able to solve how to make the printf()
after the execl()
show up when I run the program. I figured out it has something to do with the fflush()
function, although I still can't do it.
Heres the code.
#include<sys/types.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/wait.h>
#include <stdio.h>
void main(){
printf ("Show content from directory /:\n");
execl( "/bin/ls", "ls", "-l", "/", NULL );
fprintf (stdout,"End of command: ls -l /\n");
fflush(stdout);
}