[erlang-questions] "-noshell" on R9C

Oscar Hellström oscar@REDACTED
Tue Apr 3 17:31:09 CEST 2007


On Tue, 03 Apr 2007 17:11:58 +0200
Peter Lund <erlang@REDACTED> wrote:

> Trying to use io:print_chars/1 on R9C in combination with unix pipesand 
> the "-noshell" option on a new MacOS X machine.
> 
> Does anyone perhaps know why I get "[]" before each character below?

The [] are actually part of your prompt. "" is the same thing as an
empty list, try to use the '' atom instead.
 
> $ 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.
> $
> 
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions


-- 
Oscar Hellström, oscar@REDACTED
Erlang Training and Consulting




More information about the erlang-questions mailing list