Sebastian Hungerecker
9/30/2007 2:17:00 PM
Peter Vanderhaden wrote:
> Sebastian,
> My Ruby installation must be corrupt, as it doesn't recognize gets.
> When I try your solution, I get the following error message:
>
> D:/scripts/ruby/f0.rb:10:in `gets': Bad file descriptor (Errno::EBADF)
> from D:/scripts/ruby/f0.rb:10
Well, he doesn't say that he doesn't recognize gets, he says that an error
occured while executing gets.
It should be noted that Kernel#gets will open ARGV[0] as a file and read that
instead of STDIN when ARGV is not empty, which is the most common cause of
errors with gets. So if that's the problem in your case, try using STDIN.gets
instead of Kernel#gets. If that doesn't help, show the code.
> I'd assume the best way to correct this would be to reinstall Ruby?
> Would you agree?
If your gets is really broken and you're not just using it wrong, then yes.
HTH,
Sebastian
--
Jabber: sepp2k@jabber.org
ICQ: 205544826