Hi all,<br>i wrote a program in c to call the erlang functtion .<br>my erlang program is sork fine when i runit seperately.<br>but when i tried to get the vallue through the c programe it prits the foolowing statement which was the output tupple of the erl_rpc().<br>
badrpc{badrpc,{'EXIT',{badarg,[{erlang,apply,[complexrpc,print,{cnode,7}]},{rpc,'-handle_call/3-fun-0-',5}]}}}�h<br><br>my c programe is as follow<br>/* cnode_c.c */<br><br>#include <stdio.h><br>#include <sys/types.h><br>
//#include <sys/socket.h><br>#include <arpa/inet.h><br>#include "erl_interface.h"<br>#include "ei.h"<br><br>//#define BUFSIZE 1000<br>int main(int argc, char **argv) {<br> int fd;<br>erlang_msg massage;<br>
fd;<br>int n = 0;<br>ei_cnode ec;      <br>  erl_init(NULL, 0);<br>if (erl_connect_init(1, "secretcookie", 0) == -1)<br>    erl_err_quit("erl_connect_init");<br><br>  if ((fd = erl_connect("e1@localhost")) < 0)<br>
    erl_err_quit("erl_connect");<br>  fprintf(stderr, "Connected to ei@localhost\n\r");<br>if (fd<0){<br>}<br>else<br>{<br>printf("hi erlang world");<br>}<br><br>char* server_name;<br>server_name="e1@localhost";<br>
 ETERM *fromp, *tuplep, *fnp, *argp, *resp;<br>char *mod, *fun;<br>ETERM *args;<br>mod="complexrpc";<br>fun="print";<br>args = erl_format("{cnode, ~i}", 7);<br>fnp = erl_element(1,erl_rpc(fd,mod,fun , args));<br>
erl_print_term(stderr,fnp);<br>printf("hello");<br>erl_print_term(stderr,erl_rpc(fd,mod,fun , args));<br>}<br>can anyone help me to fix this matter .<br>thanks<br>