开发者

Get Input from keyboard without waiting for input

开发者 https://www.devze.com 2023-03-24 05:45 出处:网络
Functions like fgets() and getch() will wait for the user to enter input before continuing. What I want is this functionality:

Functions like fgets() and getch() will wait for the user to enter input before continuing. What I want is this functionality: If the user presses 'x' a variable will begin decrementing, 'c' will cause the variable to begin incrementing. The problem is the pr开发者_Python百科ogram halts when I try to get input. I want the variable to continue incrementing or decrementing and no 'freezing' while waiting for user input.

I am using visual studio 2008, writing a c console application.

Thanks!


You need a special CONSOLE INPUT/OUTPUT library like NCURSES or Borland's CONIO to do that. Can't do it with standard C library.

If you are using Windows exclusively, take a look at Windows Console Functions.

0

精彩评论

暂无评论...
验证码 换一张
取 消