[erlang-questions] "-noshell" on R9C
Peter Lund
erlang@REDACTED
Tue Apr 3 17:11:58 CEST 2007
Trying to use io:print_chars/1 on R9C in combination with unix pipes and
the "-noshell" option on a new MacOS X machine.
Does anyone perhaps know why I get "[]" before each character below?
$ erlc myprint.erl
$ cat test.txt
My example text.
$ cat test.txt | erl -noshell -run myprint print
[]M[]y[] []e[]x[]a[]m[]p[]l[]e[] []t[]e[]x[]t[].[]
[]Num chars 17
$ cat myprint.erl
-module(myprint).
-export([print/0]).
print() -> print(get_char(),0).
print(eof,N) ->
io:format("Num chars ~p\n",[N]),
halt();
print(C,N) when is_integer(C) ->
io:put_chars([C]),
print(get_char(),N+1).
get_char() ->
case io:get_chars("",1) of
eof -> eof;
[C] -> C
end.
$
More information about the erlang-questions
mailing list