Novice Question: Getting "bad file descriptor error" when trying to use gets in ruby 1.8.1 for windo

Discussion in 'Ruby' started by Revision17, Feb 13, 2004.

  1. Revision17

    Revision17 Guest

    Hi I'm trying to run this code:
    while (line = gets)
    puts "The given line is #{line}"
    if line =~ /^eval:(.*)$/
    puts "#$1 # => #{eval $1}"
    end
    end

    That I found on a tutorial website. Ruby gives me this error when I try to run it:
    >ruby guessnumber.rb

    higuessnumber.rb:4:in `gets': Bad file descriptor (Errno::EBADF)
    from guessnumber.rb:4
    >Exit code: 1


    Why is this happening?
     
    Revision17, Feb 13, 2004
    #1
    1. Advertising

  2. "Revision17" <> wrote in message
    > That I found on a tutorial website. Ruby gives me this error when I try

    to run it:
    > >ruby guessnumber.rb

    > higuessnumber.rb:4:in `gets': Bad file descriptor (Errno::EBADF)
    > from guessnumber.rb:4
    > >Exit code: 1

    >
    > Why is this happening?


    Are you running this through an Editor (may be SciTE or TextPad?)
    IF that is the case then try it from the command prompt.

    -- shanko
     
    Shashank Date, Feb 13, 2004
    #2
    1. Advertising

  3. Revision17

    Revision17 Guest

    "Shashank Date" <> wrote in message news:<c0io9h$18bh89$-berlin.de>...
    > "Revision17" <> wrote in message
    > > That I found on a tutorial website. Ruby gives me this error when I try

    > to run it:
    > > >ruby guessnumber.rb

    > > higuessnumber.rb:4:in `gets': Bad file descriptor (Errno::EBADF)
    > > from guessnumber.rb:4
    > > >Exit code: 1

    > >
    > > Why is this happening?

    >
    > Are you running this through an Editor (may be SciTE or TextPad?)
    > IF that is the case then try it from the command prompt.
    >
    > -- shanko


    Yes I am (SciTE). I'll try it out without when I get back to my
    computer on Sunday. Is there any way to get it to work with SciTE
    though? It's so convenient to just hit f5 and you can see the
    program's output.
     
    Revision17, Feb 14, 2004
    #3
  4. Revision17

    daz Guest


    > "Revision17" wrote:
    > > "Shashank Date" wrote:
    > >
    > > Are you running this through an Editor (may be SciTE or TextPad?)
    > > IF that is the case then try it from the command prompt.
    > >
    > > -- shanko

    >
    > Yes I am (SciTE). I'll try it out without when I get back to my
    > computer on Sunday. Is there any way to get it to work with SciTE
    > though?



    This problem was fixed in later versions of SciTE.

    There's a good one-click installer (v 1.57 unless you want
    Lua scripting support) here:

    http://gisdeveloper.tripod.com/scite.html

    Make sure you won't overwrite your customised properties files.
    You may need to refer to the way things were, later.


    > It's so convenient to just hit f5 and you can see the
    > program's output.


    Indeed it is.

    Which is one reason I use RDE:
    http://homepage2.nifty.com/sakazuki/rde_e.html
    (not as straightforward to install, but it does a whole fat lot more)


    daz
     
    daz, Feb 14, 2004
    #4
  5. Shashank Date, Feb 14, 2004
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. drs
    Replies:
    0
    Views:
    389
  2. lynology

    Bad File Descriptor Error on strcat/strcpy

    lynology, Aug 18, 2004, in forum: C Programming
    Replies:
    4
    Views:
    541
    Chris Torek
    Aug 18, 2004
  3. Replies:
    4
    Views:
    184
    plamb
    Jul 2, 2007
  4. Danica Cruz
    Replies:
    0
    Views:
    200
    Danica Cruz
    Jan 16, 2009
  5. Mwenge Mulenga

    Bad file descriptor error

    Mwenge Mulenga, Apr 11, 2009, in forum: Ruby
    Replies:
    5
    Views:
    407
    Robert Klemme
    Apr 12, 2009
Loading...

Share This Page