0

私は次のコードを持っています

class TimeReport
  def run
    init_screen
    lines = Curses::lines
    cols  = Curses::cols
    read=""

    begin
      crmode
      noecho

      gotoDay  diaActual.data.to_s #loads the screen with data

      while !read.eql?("q")
        printPrompt #simply prints the command prompt
        read=STDIN.getc
        printOnSpot 10,10,read.to_s #prints what was read

        if(!read.empty? && !read.strip.empty?)
          processPrompt(read,@ecra) # process the read command
          else
          printInfo "Say What??" 
          end
      end

    ensure

    echo
    nocrmode
    close_screen
    end
  end
end
TimeReport.new.run

アプリケーションを実行しようとすると、アプリケーションがロックされ、画面が初期化されません。Curses.getchを使用すると、この問題は発生しません。

なぜこれが起こるのかについて誰かが私に教えてもらえますか?と問題を解決する方法は?

4

1 に答える 1

1

これが、Curses と STDIN を混ぜてはいけない理由です。

于 2009-06-03T10:50:10.860 に答える