#define _GNU_SOURCE #include #include #include #include #include // ls -i -l /tmp >> log // int main(int argc, char *argv[]) { int redirection = open("./log",O_WRONLY | O_APPEND | O_CREAT , 0644); assert(redirection >= 0); // dup2 ferme 1, et duplique redirection dup2(redirection,1); close(redirection); execlp("ls","ls","-i","-l","/tmp",NULL); assert(0); return 0; }