STDIN

C

Chinna Karuppan

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
 
A

Adam Shelly

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"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,470
Messages
2,571,809
Members
48,797
Latest member
PeterSimpson
Top