-
Input from non-text file
Folks,
I was just wondering if it was possible to read in data from a non-text file using ifstreams (or indeed any other method) ?
Basically I've gotten a pdf file and I wish to extract certain parts of data from it. (not graphics, just text).
I'm guessing that I'd need to do some sort of conversion on the input data in order to be able to read the data correctly ?
Any ideas would be greatly appreciated.
Cheers
STarkhorn
ps btw, great site and a great resource. I've not posted much simply because I've managed to find most answers to my problems on the FAQ or via the search function. :) :)
-
Just open the file in binary mode and use the stream's get or read member functions to read data into an appropriate sized buffer for further parsing.
Code:
ifstream input("whatever.pdf",ios::binary|ios::in);
char buffer[1000];
...
input.read(buffer,sizeof(buffer));
...
// Now you can parse what's in the buffer
[edit]If you need to, you can get information on the format of PDF files from wotsit.org which might help.[/edit]