Reputation: 6127
How do you properly get a character list into Erlang from Elixir?
Suppose I do this is Erlang:
12> [X,Y | R] = "54686973206973206120746573742e".
"54686973206973206120746573742e"
13> X.
53
14> Y.
52
15> io_lib:fread("~16u",[53,52]).
{ok,"T",[]}
How do make that call correctly from Elixir?
:io_lib.fread("~16u",...)
I have already seen this question: Elixir io_lib call to erlang
But I still seem to get a FunctionClauseError no matter what approach I take to push the list into fread.
Upvotes: 2
Views: 216
Reputation: 41568
Using single quotes around the format string as described in the linked question seems to work:
iex(1)> :io_lib.fread('~16u', [53,52])
{:ok, 'T', []}
Upvotes: 2