Convert erlang terms to string, or decode erlang binary

前端 未结 2 1664
花落未央
花落未央 2020-12-10 01:19

I have an erlang program which generates data. This data needs to be transferred via udp to a non-erlang program for further processing. I already have this part working -

相关标签:
2条回答
  • 2020-12-10 01:48

    1) you can convert any term to string using

    R= io_lib:format("~p",[yourtermhere]),
    lists:flatten(R)
    

    2) you might look at erlang external binary format, a lot of other languages have libraries for encode/decode that erlang binaries format. And in erlang you can encode any term by term_to_binary

    0 讨论(0)
  • 2020-12-10 01:56

    I'd recommend converting the erlang terms into JSON, with either of known libraries (heard good words regarding rfc4267). It'd be a trivial task to convert JSON back with any non-erlang platform, I guess. )

    0 讨论(0)
提交回复
热议问题