From: David Vincelli Date: 2005-05-15T10:44:00+09:00 Subject: Re: re-opening STDIN after it's been closed? ------=_Part_13678_6534629.1116121419114 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Hi, On 5/14/05, nobu.nokada@softhome.net wrote: >=20 > You should alwasy check if get succeeded. >=20 > prompt =3D < Make your selection from the list below: \n > a) foo > b) bar >=20 > PROMPT >=20 > while (print(prompt); ans =3D gets) > handle_action(ans) > end I haven't tried this yet but it's definately better than what I originally= =20 posted. > Or even better if you can use readline: >=20 > while ans =3D readline(prompt) > handle_action(ans) > end But I did try this. I don't think your usage of readline is correct. ri=20 tells me that readline takes a single parameter and it's the line seperator= .=20 I suppose you meant this: while (print prompt; ans =3D readline) handle_action(ans) end No way to do it. If you believe STDIN is connected to tty, you > may want to do STDIN.reopen("/dev/tty"). Thanks for the tip. I'll stick to the fixed up while loop. --=20 David Vincelli ------=_Part_13678_6534629.1116121419114--