c-node and arbitrary erlang term
Roberto Ostinelli
roberto@REDACTED
Mon Aug 3 19:01:11 CEST 2009
dear all,
i am currently sending a message from a c-node to an erlang node using
the following:
char *e_headers = "[{one, 1}, {two, 2}]";
erlterm = erl_format("~s", e_headers);
erl_reg_send(fd, "testc", erlterm);
erl_free_term(erlterm);
free(e_headers);
fd being the file descriptor. this works without any issues, and as
expected on the process testc i get the string "[{one, 1}, {two, 2}]".
however, since the string "[{one, 1}, {two, 2}]" is already in erlang
format, i read from erl_format specs <http://erlang.org/documentation/doc-5.5.3/lib/erl_interface-3.5.5.3/doc/html/erl_format.html
> that i could use:
~w - Arbitrary Erlang term
however, if i change in the above code the line to:
erlterm = erl_format("~w", e_headers);
i get a bus error and my c-node crashes.
i could of course parse the string and re-build an erlang term from
the incomed string, however this is obviously something i want to
avoid. what am i missing?
thank you,
r.
More information about the erlang-questions
mailing list