cconio

whats the difference between _kbhit and kbhit in C?


I know kbhit "Determines if a keyboard key was pressed" but I see that people use both _kbhit and kbhit interchangeably.


Solution

  • According to this page on MSDN - kbhit is deprecated

    The Microsoft-specific function name kbhit is a deprecated alias for the _kbhit function. By default, it generates Compiler warning (level 3) C4996. The name is deprecated because it doesn't follow the Standard C rules for implementation-specific names. However, the function is still supported.

    We recommend you use _kbhit instead. Or, you can continue to use this function name, and disable the warning. For more information, see Turn off the warning and POSIX function names.