Erlang/OTP Forums

Author Message

<  Erlang  ~  How to read from standard input?

prinzdezibel
Posted: Sat Nov 03, 2007 4:39 pm Reply with quote
Joined: 03 Nov 2007 Posts: 1
I cannot figure out how to read from standard input (erlang shell) when starting a module's function from erlang shell. Joe Armstrong's book mentions it in Chapter 13 when explaining io:read(ioDevice,Prompt). But there is no example how it actually works. Any hints? Thanks.
View user's profile Send private message
admin
Posted: Mon Nov 05, 2007 8:12 am Reply with quote
Site Admin Joined: 28 Jun 2006 Posts: 108
Have you tried (from the io manual page)

Code:

get_chars([IoDevice,] Prompt, Count) -> string() | eof
get_line([IoDevice,] Prompt) -> string() | eof


eg:

Code:
2> X = io:get_line('>').
>FooBar
"FooBar\n"
3> X.
"FooBar\n"


Hope this helps,
Francesco
--
http://www.erlang-consulting.com
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum