Reputation: 456
so i have these following
A = <<1:1>>
and B = <<1>>.
Any built in function(or couple of lines of code) to join these two binaries, which total size should be 16 bits ?
Have already tried following:
C = <<B/binary,A:8/bitstring>>.
C = <<B/binary,A:8/binary>>.
C = <<B/binary,A:8>>.
C = <<B/binary,A/bitstring>>.
This works but the size will be 9 bits long.
P.S I dont want 8 lines of erlang code as a solution.
Upvotes: 4
Views: 2560
Reputation: 40424
You probably need to add some padding:
<< B/binary, 0:7, A/bitstring >>.
Upvotes: 6