title: Reading file byte by byte
body: <p>I am attempting to read a binary file byte by byte, for some simple encryption-decryption program:</p>
  
  <pre><code>iftream f("a.in", ios::binary | ios::in);
  ofstream g("a.out");
  char x1, x2;
  int x,j=0;
  f.seekg(0);
  f.get(&amp;x1,sizeof(char));
  while(!f.eof())
  {
      f.get(&amp;x2,sizeof(char));
      if(j==10)
      {
          g&lt;&lt;'\n';
          j=0;
      }
      x=x1+x2;
      x1=x2;
      g&lt;&lt;x&lt;&lt;' ';
      j++;
  }
  </code></pre>
  
  <p>The code compiles, but the while() is stuck in an infinite loop, which is because the get() functions are not actually reading anything from the file.</p>
  
  <p>I imagine it may be because of the dereferencing of the chars, but get() would only accept a pointer as its first argument.</p>
  
  <p>Could anyone point out where I went wrong, please?</p>