How to build a binary of 1024 zeros?

Matthias Lang <>
Mon May 29 12:12:59 CEST 2006


Romain Lenglet writes:
 > Andrew Lentvorski wrote:
 > > Is there an equivalent to lists:duplicate(1024, 0), but for
 > > binaries?
 > 
 > <<0:1024>>

<<0:8192>>, assuming Andrew means 1024 octets.

But that only works for the special cases 0x00 and 0xff, i.e. you
can't do the equivalent of lists:duplicate(1024, 99).

Matthias



More information about the erlang-questions mailing list