B
Bill Atkins
How can I determine if there's input waiting on STDIN before calling
gets? This code doesn't do the trick:
----
while true
r, w, e =3D select [$stdin], [], [], 1
=20
if r and r.include? $stdin
puts "READY TO READ!"
end
end
-----
Apparently, r always includes $stdin, so it just continuously prints
"READY TO READ".
--=20
Bill Atkins
gets? This code doesn't do the trick:
----
while true
r, w, e =3D select [$stdin], [], [], 1
=20
if r and r.include? $stdin
puts "READY TO READ!"
end
end
-----
Apparently, r always includes $stdin, so it just continuously prints
"READY TO READ".
--=20
Bill Atkins