From: Bill Kelly Date: 2002-12-06T03:26:21+09:00 Subject: Re: Best way to read data? I wrote: > > while(line = gets) > > p line > > end > > > > I'm getting: > > C:\tmp>2.rb < "data.dat" > > C:\tmp\2.rb:1:in `gets': Bad file descriptor (Errno::EBADF) > > from C:\tmp\2.rb:1 > > > > Using Win2K. :-( > # ruby test2.rb < "test2.rb" > Sorry, I don't understand why your code isn't working. Is "data.dat" > a text file or a binary file? (Just grasping at straws...) Ahh! Oops, yes, if I invoke test2.rb directly, instead of running ruby explicitly, I get the same error: # test2.rb < "test2.rb" P:\code\ruby\bkelly\test2.rb:3:in `gets': Bad file descriptor (Errno::EBADF) from P:\code\ruby\bkelly\test2.rb:3 Don't know why... :( Bill