dup.c 408 B

123456789101112131415
  1. /* -*- mode:c; c-file-style:"k&r"; c-basic-offset: 4; tab-width:4; indent-tabs-mode:nil; mode:auto-fill; fill-column:78; -*- */
  2. /* vim: set ts=4 sw=4 et tw=78 fo=cqt wm=0: */
  3. #include <stdio.h>
  4. #include <unistd.h>
  5. int main(int argc, char ** argv)
  6. {
  7. dup2(1, 255);
  8. close(1);
  9. FILE * new_stdout = fdopen(255, "a");
  10. fprintf(new_stdout, "Hello World!\n");
  11. fflush(new_stdout);
  12. return 0;
  13. }