a simple question

matthias@REDACTED matthias@REDACTED
Tue May 8 08:52:13 CEST 2001


Hi,

    Jonas> I have simple and short problem: I start a module that only
    Jonas> waits for input from the shell (with "In =
    Jonas> io:read("input>")) and starts this function recursive after
    Jonas> any input. But I get no input prompt on one computer and
    Jonas> one input prompt and no more on the other computer, both
    Jonas> are PCs running Windows 98. Is this a problem due to the
    Jonas> current OTP-Release 5.0 R7B6 or is it just a simple fault
    Jonas> of mine?

Specificially: Perhaps you're not entering a complete term, though
that doesn't explain the difference between systems. I don't know of
any such problem, but then again I don't use windows.

In general: if you post a problem like this, you're more likely to get
a good answer if you post 

   - a short but complete module which demonstrates the problem.

   - a copy of the input/output showing the behaviour you saw

Here's an example which does pretty much what I expect on my system:

-module(jonas).
-export([go/0]).

go() ->
        {ok, In} = io:read('Input>'),
        ok = io:fwrite("got: ~p\n", [In]),
        go().

Running it on my R7B node:

8> c(jonas).  
{ok,jonas}
9> jonas:go().
Input>bla
Input>.
got: bla
Input>
Input>3.
got: 3

I don't know why io:read treats its argument as a term rather than a
string, but this isn't uncommon in older parts of the library. Maybe
someone from Blutail/Alteon/Nortel can tell the story about the day Mr
Term and Mr String had an argument and stopped being two sides of the
same coin. ;-)

Matthias




More information about the erlang-questions mailing list