Your description is very confusing. <div>Erlang runs a c++ app and communicates with it over a port?<div>Your problem is how to actually launch Erlang that executes your code?</div><div>erl -eval "module:function()"<br>
<div><br></div><div><br></div><div>Sergej<br><br><div class="gmail_quote">On Wed, Jun 13, 2012 at 11:51 AM, benefit <span dir="ltr"><<a href="mailto:dangodiac@gmail.com" target="_blank">dangodiac@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello.<br>
Please help me.<br>
I need to make a erlang gen_server which works with an erlang port.<br>
An c++ application must connect to erlang port and send a string. Server<br>
should return the same string to the application.<br>
<br>
I have troubles working with erlang.<br>
I found an example code :<br>
<br>
connect(Message) -><br>
    Cmd = "./myqtwindowapp \n",<br>
    Port = open_port({spawn,Cmd}, [stream,use_stdio,exit_status]),<br>
    Payload = string:concat(Message, "\n"),<br>
    erlang:port_command(Port, Payload),<br>
    receive<br>
        {Port, {data, Data}} -><br>
            ?DBG("Received data: ~p~n", [Data]),<br>
        Other -><br>
            io:format("Unexpected data: ~p~n", [Other])<br>
    after 15000 -><br>
            ?DBG("Received nothing~n", [])<br>
    end.<br>
<br>
<br>
But i dont know how to run this code. I tried erl -run serv start but<br>
recieved error in do_boot. And how to include this code into a small module?<br>
Even i recieved error in dbg macros.<br>
<br>
Please help me. Suggest me how to finalize. I am newbie here, please suggest<br>
me how to run this code or other.<br>
Any help is appreciated.<br>
<br>
--<br>
View this message in context: <a href="http://erlang.2086793.n4.nabble.com/Erlang-gen-server-and-c-client-tp4655136.html" target="_blank">http://erlang.2086793.n4.nabble.com/Erlang-gen-server-and-c-client-tp4655136.html</a><br>

Sent from the Erlang Questions mailing list archive at Nabble.com.<br>
_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br></div></div></div>