[erlang-questions] Binaries

Sverker Eriksson sverker.eriksson@REDACTED
Tue Jun 19 17:51:47 CEST 2018


If you mean 16#1450000001, then

<<16#1450000001:40/big>>

will give you a 5 byte (40 bits) big endian format

<<16#14,16#50,16#00,16#00,16#01>>


If you mean 1450000001 as a decimal integer, then my guess is you do not
actually want that.


integer_to_list produces ASCII characters.


/Sverker

On tis, 2018-06-19 at 16:32 +0100, Bob Cowdery wrote:
> If I have a number, say 1450000001 and I want to represent that as a 
> binary in the form
> 
>   <<16#14,16#50,16#00,16#00,16#01>> what's the best way.
> 
> I'm not sure what list_to_binary(integer_to_list(1450000001)) which 
> prints as <<"1450000001">> produces but I guess its 10 bytes not 5.
> 
> BobC
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions


More information about the erlang-questions mailing list