I'm working on writing a predictor function for descrambling decompressed pdf streams and one of the instructions I am using mentions the use of binary strings.
For example.
I open the file in binary mode and extract one character at a time.
At some stage these characters need to be split into their width components for example there are 4 per line I would allocate one character to the first column, two to the second column and one character to the third column.
If I am to convert the first columns character to a binary string for this purpose I assume that is just leaving it as it is.
But the second column is two bytes wide. Once I create a binary string of two bytes wide I then can convert it to an int. I'm just not sure how to do create a binary string for this purpose. I thought of bitshift operations though a character being only 8 bits I would maybe need to create a two bye wide int in a bitfield or something to contain the first character << 8 places plus the second character.
Does anyone understand what has to be done in this instance?
A character width of two bytes would be a char16_t as defined in x11. This is to differentiate it from a char32_t which is four bytes wide and a straight-default char which is only one.
What tutorial are you using by the way? I distinctly remember rage quitting at the idea of parsing PDF files a long time ago but your post has re-kindled my interest.
Well, I know how you felt. I've taken a very long term view of this and only this has kept me going. Thanks for the tip as well.
Here is the instructions I am referring to. https://forums.adobe.com/thread/664902
Somewhere in there it refers to binary strings and converting them back to int.
Maybe I have interpreted it wrong.
As for parsing pdf's, the above link is in relation to decoding a compressed stream with Decode Parameters. In the case I'm pursuing, a cross-reference stream. Unfortunately the library I am using for parsing the pdf's does everything but decode these streams properly. I think there must be errors in their coding for predictors or Adobe has changed something. The library is Podofo. It's quiet extensive.
How do you interpret the instructions on the link I've posted in step 8?
Thanks.