[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

very simple question

Tom Cloyd

12/30/2005 9:26:00 AM

Bewilderer, tired beginner, here.

Executing this, in Arachno Ruby IDE -

print 'process ' + filenm + ' (1) or all files of type ' + filetyp + ': '
pf = gets

I get -
1. nothing for my print statement - control just passes right past it.
2. a "Exception: Bad file descriptor" out for "pf = gets"

I don't understand why either is happening. Can someone clear this up for
me?

-- Tom C.


5 Answers

Joe Van Dyk

12/30/2005 9:31:00 AM

0

On 12/30/05, Tom Cloyd <tomcloyd@bestmindhealth.com> wrote:
> Bewilderer, tired beginner, here.
>
> Executing this, in Arachno Ruby IDE -
>
> print 'process ' + filenm + ' (1) or all files of type ' + filetyp + ': '
> pf = gets
>
> I get -
> 1. nothing for my print statement - control just passes right past it.
> 2. a "Exception: Bad file descriptor" out for "pf = gets"
>
> I don't understand why either is happening. Can someone clear this up for
> me?

I don't understand what you're trying to do.


Tom Cloyd

12/30/2005 9:41:00 AM

0

This is just a snippet from a larger program. Here, I'm trying to print to
STOUT a prompt, then get a response, so I can act on it.

t.

On Fri, 30 Dec 2005 01:30:42 -0800, Joe Van Dyk <joevandyk@gmail.com>
wrote:

> On 12/30/05, Tom Cloyd <tomcloyd@bestmindhealth.com> wrote:
>> Bewilderer, tired beginner, here.
>>
>> Executing this, in Arachno Ruby IDE -
>>
>> print 'process ' + filenm + ' (1) or all files of type ' + filetyp + ':
>> '
>> pf = gets
>>
>> I get -
>> 1. nothing for my print statement - control just passes right past it.
>> 2. a "Exception: Bad file descriptor" out for "pf = gets"
>>
>> I don't understand why either is happening. Can someone clear this up
>> for
>> me?
>
> I don't understand what you're trying to do.
>



Tom Cloyd

12/30/2005 9:46:00 AM

0

I just ran this (example from a book) --

print "Enter your name: "
name = gets

And had exactly the same problem. However, running it outside of
ArachnoRuby, simply as a Ruby file (I'm on WinXP), it runs fine. So, I
have a problem with how my IDE is functioning - I'm new to that as well.
I'll look at that...

t.

On Fri, 30 Dec 2005 01:30:42 -0800, Joe Van Dyk <joevandyk@gmail.com>
wrote:

> On 12/30/05, Tom Cloyd <tomcloyd@bestmindhealth.com> wrote:
>> Bewilderer, tired beginner, here.
>>
>> Executing this, in Arachno Ruby IDE -
>>
>> print 'process ' + filenm + ' (1) or all files of type ' + filetyp + ':
>> '
>> pf = gets
>>
>> I get -
>> 1. nothing for my print statement - control just passes right past it.
>> 2. a "Exception: Bad file descriptor" out for "pf = gets"
>>
>> I don't understand why either is happening. Can someone clear this up
>> for
>> me?
>
> I don't understand what you're trying to do.
>



--

================================================
Tom Cloyd, MS MA, LMHC
Private practice Psychotherapist
Bellingham, Washington, U.S.A: (360) 920-1226
<< TC.BestMindHealth.com / BestMindHealth.com >>
<< tomcloyd@bestmindhealth.com >>
================================================


Robert Klemme

12/30/2005 11:31:00 AM

0

Tom Cloyd <tomcloyd@bestmindhealth.com> wrote:
> I just ran this (example from a book) --
>
> print "Enter your name: "
> name = gets
>
> And had exactly the same problem. However, running it outside of
> ArachnoRuby, simply as a Ruby file (I'm on WinXP), it runs fine. So, I
> have a problem with how my IDE is functioning - I'm new to that as
> well. I'll look at that...

This is probably an issue of buffered IO and / or changed outputs. I'd try

$stdout.sync = true
$stdout.print "Enter your name: "
name = $stdin.gets

HTH

robert

J. Ryan Sobol

12/30/2005 2:38:00 PM

0

I don't run Win XP, but my first thought is verify the path to your
ruby interpreter in your IDE.
____ _ _ ____ ____
/ ___) | | |/ _ | _ | | | |_| ( ( | | | | |
|_| \__ |\_||_|_| |_|
(____/


On Dec 30, 2005, at 4:46 AM, Tom Cloyd wrote:

> I just ran this (example from a book) --
>
> print "Enter your name: "
> name = gets
>
> And had exactly the same problem. However, running it outside of
> ArachnoRuby, simply as a Ruby file (I'm on WinXP), it runs fine.
> So, I have a problem with how my IDE is functioning - I'm new to
> that as well. I'll look at that...
>
> t.
>
> On Fri, 30 Dec 2005 01:30:42 -0800, Joe Van Dyk
> <joevandyk@gmail.com> wrote:
>
>> On 12/30/05, Tom Cloyd <tomcloyd@bestmindhealth.com> wrote:
>>> Bewilderer, tired beginner, here.
>>>
>>> Executing this, in Arachno Ruby IDE -
>>>
>>> print 'process ' + filenm + ' (1) or all files of type ' +
>>> filetyp + ': '
>>> pf = gets
>>>
>>> I get -
>>> 1. nothing for my print statement - control just passes right
>>> past it.
>>> 2. a "Exception: Bad file descriptor" out for "pf = gets"
>>>
>>> I don't understand why either is happening. Can someone clear
>>> this up for
>>> me?
>>
>> I don't understand what you're trying to do.
>>
>
>
>
> --
>
> ================================================
> Tom Cloyd, MS MA, LMHC
> Private practice Psychotherapist
> Bellingham, Washington, U.S.A: (360) 920-1226
> << TC.BestMindHealth.com / BestMindHealth.com >>
> << tomcloyd@bestmindhealth.com >>
> ================================================
>