Stdin

Hi,
I was trying to use the STDIN.read in the IRB .This keep eating what
ever I type .it never comes to the next line.I am not sure what is
happening …I not that famailiar with IO blocking …probably the
STDIN blocked something for reading…
can some point to some kind of tutorial on Ruby’s IO or explain what is
wrong with STDIN.read
THnks
Chinna

On 4/23/08, Chinna K. [email protected] wrote:

Hi,
I was trying to use the STDIN.read in the IRB .This keep eating what
ever I type .it never comes to the next line.I am not sure what is
happening …

the read method without any arguments will read until the end of file.
For stdin
you can signal end-of-file by typing Ctrl-Z.

irb(main):002:0> s=STDIN.read
hello
world
^Z
=> “hello\nworld\n”

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs