出力の一時停止と再開
Posted feedbacks - Erlang
p[enter]しないと止まりません。。。 open_portとかも見てみたのですが、、、誰か教えてください。。。 erl -noshell -s intter -s init stop
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | -module(intter).
-export([start/0,puta/1]).
start()->
P = spawn(intter,puta,"a"),
loop(P).
loop(P) ->
case io:get_chars('',1) of
"q" ->
halt();
I ->
P ! I,
loop(P)
end.
puta(Status)->
receive
"p" ->
case Status of
"p" ->
io:format("a"),
puta("a");
_ ->
puta("p")
end
after 1000 ->
case Status of
"p"->
ok;
_ ->
io:format("a")
end,
puta(Status)
end.
|


nobsun
#6346()
Rating3/3=1.00
起動すると、標準出力に1秒毎に'a'の1文字を出力し続けるプログラムで、 以下の条件を満たすものを「どう書く?」
[ reply ]