[#3006] mismatched quotation — "stevan apter" <apter@...>

ruby documentation uses a punctuation convention i've never seen

13 messages 2000/05/27

[ruby-talk:02999] Re: Problem with getc under UNIX with ruby 1.4.3

From: matz@... (Yukihiro Matsumoto)
Date: 2000-05-25 22:46:09 UTC
List: ruby-talk #2999
Hi,

In message "[ruby-talk:02990] Problem with getc under UNIX with ruby 1.4.3"
    on 00/05/25, "David Douthitt" <DDouthitt@cuna.com> writes:

|# ./test.rb
|;lakjdf;klasjdf;klasjdf;klasdjf;asdkjf;klasjf
|59
|# cat test.rb
|#!/usr/bin/ruby
|
|str = STDIN.getc
|p str
|
|#
|
|[.....CUT!...]
|
|I would have expected output to look like this:
|
|# ./test.rb
|59
|#
|
|That is - no echo, instant response, no carriage return needed - or
|put another way, just as if you used "getc" (crunch!).

That' what UNIX getc is by default.  You can:

  #!/usr/bin/ruby

  begin
    system("stty raw -echo")
    str = STDIN.getc
  ensure
    system("stty -raw echo")
  end
  p str

							matz.

In This Thread

Prev Next