[#42243] コミュニティと宗教の分離について — Beyond <beyond@...>

14 messages 2006/05/21

[#42267] メニューのループについて — リックス <rubyer4649@...>

りっくすです

21 messages 2006/05/27

[#42301] Re: メニューのループについて — "conundrum /" <conundrum@...>

conundrumです。

11 messages 2006/05/28

[ruby-list:42280] Re: メニューのループについて

From: arton <artonx@...>
Date: 2006-05-27 19:04:52 UTC
List: ruby-list #42280
artonです。

>> 1ー3を押してるときは何回もメニューが表示され
ここを見過ごしてました。

require 'dl/import'
module MSVCRT
  extend DL::Importable
  if RUBY_PLATFORM =~ /mswin/
    dlload "MSVCRT.DLL"
    extern "int _kbhit()"
    extern "int _getch()"
  else
    puts "sorry, don't support your environment"
    exit(1)
  end
end

MENU = [?1,?2,?3]

def show(c)
  if MENU.include?(c)
    MENU.each do |i|
      printf("%c:test%c\n", i, i)
    end
  elsif c == ?q
    exit(0)
  else
    puts "ok (#{"%c" % c})"
  end
end

show(?1)
while true
  unless MSVCRT._kbhit == 0
    show MSVCRT._getch
  end
end

-- 
arton <artonx@yahoo.co.jp>

--------------------------------------
Yahoo! JAPAN 10th Anniversary Special Feature
--- Enjoy Yahoo! Auction with Yahoo! Mail !! ---
http://pr.mail.yahoo.co.jp/auction/

In This Thread