title: How to read a binary file and save it inside a pipe
body: <p>I used the code below to open a binary file <code>fp</code> (the file contain a saved 2D array) and put it inside a pipe:</p>
  
  <pre><code>if ((fp=fopen("file", "rb"))==NULL) {
      printf("Cannot open file.\n");
  }
  if (fread(array, sizeof(int), 5*5, fp) != 5*5) {
      if (feof(fp))
          printf("Premature end of file.");
  } else {
      printf("File read error fread.");
  }
  </code></pre>
  
  <p>Is this the code to put it inside the pipe?</p>
  
  <pre><code>close(fd[0]);
  if ((ch=fgetc(fp))==EOF)
      write(fd[1], &amp;ch, 1 );
  </code></pre>
  
  <p>If I want to make a sum of the array, how could I make it?</p>