SCR/SCR3.1/TP5/ex2.c
2023-10-05 15:01:26 +02:00

16 lines
293 B
C

#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char** argv){
if (args != 2){
printf("Usage : %s <file>", argv[0]);
return EXIT_FAILURE;
}
int p[2], fd;
fd = open(argv[1],
pipe(p);
execl("/usr/bin/ls", "ls", "-i", "-l", "/tmp", NULL);
dup2(p[0],0);