怎么做(!kbhit())COBOL等效?

时间:2016-06-09 17:13:55

标签: cobol

我想使用isCOBOL编译器检测COBOL中的按键事件。怎么做?

EX in C:

if(time==despert_time){ while(!kbhit()){ Beep(500,500); } }

1 个答案:

答案 0 :(得分:1)

看起来您希望从控制台获得用户交互。 如果它没有在一个时间范围内发生:哔声

PERFORM FOREVER *> or UNTIL EXIT or UNTIL 0 = 1, depending on the available extensions
   ACCEPT OMITTED *> or ACCEPT DUMMY [which you'd define as 77 DUMMY PIC X.], depending on the available extensions
      BEFORE TIME 500 *> [or WITH TIMEOUT 500] this is a more or less common extension, with most vendors using a different time scale --> may need to change the 500
   END-ACCEPT
   IF keypressed NOT = timeout *> the actual var to be checked and the timeout value need to be checked in the docs
      EXIT PERFORM
   END-IF
   CALL x'E5'
      ON EXCEPTION *> the system call x'E5' for beep may not be available
         DISPLAY SPACE AT 2080 WITH BEEP *> may not be available, too...
   END-CALL
END-PERFORM

查看编译器随附的在线文档(“仅供客户使用”,因此我们无法检查)。