Any way to peek at the first character of $stdin without actually
consuming it?
I tried using #rewind but get a seek error.
Thanks.
Any way to peek at the first character of $stdin without actually
consuming it?
I tried using #rewind but get a seek error.
Thanks.
What about IO#getc and IO#ungetc.
Regards,
Ammar
On Mon, Dec 27, 2010 at 8:12 PM, Intransition <transfire@gmail.com> wrote:
Any way to peek at the first character of $stdin without actually
consuming it?
> Any way to peek at the first character of $stdin without actually
> consuming it?
I assume you don't want to look at the first char as soon as it's
typed
What about IO#getc and IO#ungetc.
On versions < 1.9 these will only read bytes, regardless of $KCODE.
What's a reasonable alternative, $stdin.readline.chars.to_a[0] ?
On Dec 27, 11:06 am, Ammar Ali <ammarabu...@gmail.com> wrote:
On Mon, Dec 27, 2010 at 8:12 PM, Intransition <transf...@gmail.com> wrote: