I'm using the following code to read the content of a PDF file:
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 < bytes; i++){
document += buffer[i];
cout << buffer[i];
}
}
fclose ( f );
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
results in this output: files.flashfan.ch/output.png
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):
Thanks for your help!