Granted this is more of an Erlang question – why is this producing a badarg
for those of you that have tried to write your ets
tables to files? The web and ets docs aren’t explaining it for me. Thanks
http://erldocs.com/19.0/stdlib/ets.html#tab2file/2
$ iex
Erlang/OTP 19 [erts-8.1] [source] [64-bit] [smp:2:2] [async-threads:10] [kernel-poll:false]
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> t = :ets.new(:the_table, [:bag, :named_table, :public])
:the_table
iex(2)> :ets.insert(t, {:x, "xylophone"})
true
iex(3)> :ets.tab2list(t)
[x: "xylophone"]
iex(4)> :ets.tab2file(t, "foo.txt")
{:error, {:badarg, [file: "foo.txt"]}}
iex(5)> :ets.tab2file(t, "foo")
{:error, {:badarg, [file: "foo"]}}
iex(6)> :ets.tab2file(t, :filename.absname("foo"))
{:error, {:badarg, [file: "/home/bibek/Workspace/foo"]}}
iex(7)> File.touch("foo.txt")
:ok