What’s the proper way to add a String of arbitrary size to a Binary using the Bit Syntax? Everything needs to be in little endian. I’ve tried this:
example() ->
Cmd = 16#4e584e43,
Text = "hello::",
<<Cmd:32/unsigned-little-integer,Text/little-bitstring>>.
But get the exception:
** exception error: bad argument
in function bit_size/1
called as bit_size("hello::")
in call from packet:example/0
in call from packet:main/0
Does this do what you want?
This just treats your string as a binary with one byte per character, so no endianness applies.