This repository has been archived on 2024-12-16. You can view files and clone it, but cannot push or open issues or pull requests.
CodeBlocksPortable/WATCOM/samples/clibexam/kbhit.c

20 lines
314 B
C
Raw Normal View History

/*
* This program loops until a key is pressed
* or a count is exceeded.
*/
#include <stdio.h>
#include <conio.h>
void main()
{
unsigned long i;
printf( "Program looping. Press any key.\n" );
for( i = 0; i < 10000; i++ ) {
if( kbhit() ) {
getch();
break;
}
}
}