Skip to content

Parsing binary data #191

Answered by foonathan
afeinman-snap asked this question in Q&A
Discussion options

You must be logged in to vote

Ignoring the atom_name, I'm assuming you want something like this: https://godbolt.org/z/Wcsnb97j1 This parses either a uint32 represenation of 1 (you might want a different endianness), followed by a uint64, or another uint32. It then matches that many bytes.

Unfortunately, if the size isn't immediately followed by the contents, you can't directly use dsl::repeat without loosing the additional information in the header... I have to add something for that.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by foonathan
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