erlang :binary.list_to_binary gives argument error

I am trying to convert the list to binary through :binary.list_to_bin()
For value from 0-255 it works fine but as soon as I pass values like [256, 300]
it gives an argument error.

How do I convert a list of integers to binary i.e. [1, 255, 300]

Thanks for the help

1 Like

You cannot convert that list to binary, as binary can contain only values up to 255. Without knowing how to encode 300 you cannot convert this list to binary.

Thanks for the clarification.