[erlang-questions] Reading fixed structures from file

Dave Smith dizzyd@REDACTED
Mon Mar 3 17:21:24 CET 2008


On Sat, Mar 1, 2008 at 2:37 PM, Gleb Peregud <gleber.p@REDACTED> wrote:
> Thanks a lot.
>
>  imho my code is more readable :) But it's matter of taste.
>
>  Nevertheless, to avoid confusion, i'll ask explicitly:
>
>
>  Key:4/little-integer-unit:8
>
>  matches four integers each having 8 bits, right?

No. You could read that line as:

"Key" is a 4-unit little-endian integer, where each unit has 8 bits.

You could also write:

Key:16/little-integer:2 or Key:8/little-integer-unit:4 or .....

Hope that helps.

D.



More information about the erlang-questions mailing list