[erlang-questions] Simple binary question

Dmitrii 'Mamut' Dimandt dmitriid@REDACTED
Tue Aug 21 10:21:39 CEST 2007

Suppose I have a binary:

00 00 31 00 00

This 16#31 is actually "1" in ascii.

However, if I do a <<_Pad:2/binary, Number/integer, _Rest/binary>> or
<<_Pad:2/binary, Number:1/binary, _Rest/binary>> I get 16#31.

If I do a binaty_to_list/1 or integer_to_list/1 I still get 16#31.

How do I get "1", if it's at all possible?

Thank you

More information about the erlang-questions mailing list