title: C++ Reading a PDF file
body: <p>I'm using the following code to read the content of a PDF file:</p>
  
  <pre><code>string document;
  FILE * f;
  f = fopen ( path , "rb");
  unsigned char buffer[1024];
  while(!feof(f)){   
      int bytes = fread(buffer,1,1024,f);
      for(int i = 0; i &lt; bytes; i++){
          document += buffer[i];
          cout &lt;&lt; buffer[i];
      }
  }
  fclose ( f );
  </code></pre>
  
  <p>The problem is, that the chars are not the same as when I open the file in a text editor.
  For example this file
  files.flashfan.ch/file.png</p>
  
  <p>results in this output:
  files.flashfan.ch/output.png</p>
  
  <p>How can I read the file, so that the chars are exactly the same as in the editor?
  I want to parse PDF files, but without the original chars I cant to this.
  I've testet the code with this file (its not a PDF file, just a part of one, so you can't display it):</p>
  
  <p><a href="http://files.flashfan.ch/PDF%20Header.pdf" rel="noreferrer">PDF Head.pdf</a></p>
  
  <p>Thanks for your help!</p>