title: How do I modify the stream from one file to another
body: <p>I need to make a program that takes string data from one file and copy every third char from it to another file. </p>
  
  <p>I am not sure if I am doing it right. The idea I got is to first create one array where I will store original data from file1 and then using 'for' loop I will modify the data and store in in the second array:
  (eg for(i=0; i &lt; arraysize; i+=3);
  The thing is I dont have an idea how to transfer input to my array and how to do it backwards to have my modified data go to file2. </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;sys/types.h&gt;
  #include &lt;sys/stat.h&gt;
  #include &lt;fcntl.h&gt;
  
  #define BUFFER_SIZE 50
  
  int main(int argc, char *argv[]) {
      char buffer[BUFFER_SIZE];
      char modified[BUFFER_SIZE];
      int input_fd, output_fd;
      ssize_t ret_in, ret_out;
      if(argc !=3 || strcmp(argv[1], "--help") == 0)
      {
          printf("Usage: %s file_origin file_destination\n", argv[0]);
          return 2;
      }
      input_fd = open(argv[1], O_RDONLY);
      if(input_fd == -1)
      {
          perror("There is no such file");
          return 2;
      }
      out_fd = open(argv[2], O_RDWR | O_CREAT | O_TRUNC, 0644);
      if(output_fd == -1)
      {
          perror("create");
          return 3;
      }
  
  </code></pre>
  
  <p>Could someone please tell me how to use function read/write correctly to stream my data to array and how to do it the other way.</p>