dup.c 256 B

123456789101112
  1. #define _XOPEN_SOURCE 700
  2. #include <stdio.h>
  3. #include <unistd.h>
  4. int main(int argc, char** argv) {
  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. }