Skip to content

Parsing CString array with given total length #14

Answered by MatrixEditor
dougsm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @dougsm, if I understand your case correctly you want something similar to this: Chaining

The structure would then look like this:

@struct
class Format:
    length: uint8
    values: Bytes(this.length) & CString[...]
    ...

This code will create a new temporary parsing stream for the amount of N next bytes and will apply greedy parsing only within that new stream.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@dougsm
Comment options

Answer selected by dougsm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants