# Very simple question

**URL:** <https://www.ruby-forum.com/t/very-simple-question/51370>\
**Category:** Ruby\
**Created:** [December 30, 2005, 10:27am UTC](https://www.ruby-forum.com/t/very-simple-question/51370 "2005-12-30T10:27:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 30, 2005, 10:27am UTC](https://www.ruby-forum.com/t/very-simple-question/51370/1 "2005-12-30T10:27:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 30, 2005, 10:33am UTC](https://www.ruby-forum.com/t/very-simple-question/51370/2 "2005-12-30T10:33:05Z")

</div>

On 12/30/05, Tom C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 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.

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 30, 2005, 10:42am UTC](https://www.ruby-forum.com/t/very-simple-question/51370/3 "2005-12-30T10:42:11Z")

</div>

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 D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 30, 2005, 3:38pm UTC](https://www.ruby-forum.com/t/very-simple-question/51370/4 "2005-12-30T15:38:42Z")

</div>

I don’t run Win XP, but my first thought is verify the path to your  
ruby interpreter in your IDE.

* * *

/ _) | | |/ \_ | \_   
| | | || ( ( | | | | |  
|| \__ |\_||_|_| |_|  
(_\_\_\_/

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 30, 2005, 10:48am UTC](https://www.ruby-forum.com/t/very-simple-question/51370/5 "2005-12-30T10:48:20Z")

</div>

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 D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > 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 C., MS MA, LMHC Private practice Psychotherapist Bellingham, Washington, U.S.A: (360) 920-1226 \<\< [TC.BestMindHealth.com](http://TC.BestMindHealth.com) / [BestMindHealth.com](http://BestMindHealth.com) \>\> \<\< removed\_email\_address@domain.invalid \>\>

---

<div class="post-metadata">

**Author:** ![tbcox23](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@tbcox23](https://www.ruby-forum.com/u/tbcox23)\
**Post date:** [December 31, 2005, 12:30pm UTC](https://www.ruby-forum.com/t/very-simple-question/51370/6 "2005-12-31T12:30:19Z")

</div>

Tom C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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

```
