title: redirectioning printf to pipe C
body: <p>The code above does not give any warnings or errors, but the parent does not print the string passed with the pipe. Any idea?</p>
  
  <pre><code>pid_t pid;
  int fd[2];
  int num_bytes_read;
  char buffer[80];
  pipe (fd);
  pid=fork();
  if (pid == 0) {/*Son*/
      fclose(stdout);
      close(fd[0]);
      dup(fd[1]);
      printf ("write in pipe\n");
      fflush(stdout);
  }
  else { /*Parent*/
      close (fd[1]);
      num_bytes_read = read (fd[0], buffer, sizeof (buffer));
      printf ("The received string is: %s\n", buffer);
  }
  return (0);
  </code></pre>