dup.c 232 B

123456789101112
  1. #include <stdio.h>
  2. #include <unistd.h>
  3. int main(int argc, char ** argv)
  4. {
  5. dup2(1, 255);
  6. close(1);
  7. FILE * new_stdout = fdopen(255, "a");
  8. fprintf(new_stdout, "Hello World!\n");
  9. fflush(new_stdout);
  10. return 0;
  11. }