as you know, when using getch() in windows, the applications waits for you until you press a key,
how can i read a key without freezing the program , example :
void main(){
char c;
while(1){
printf("hello\n");
if (c=getch()) {
.
.
.
}
}
thank you.
main()
returns anint
by the way :) – 1'' Nov 25 '12 at 1:37kbhit()
from<conio.h>
, I believe. Andmain()
should return anint
. – Jonathan Leffler Nov 25 '12 at 1:40kbhit [c]
turns up 80+ questions. Andgetch()
comes from the same header, so it is reasonable to suppose that if they can usegetch()
they can alsokbhit()
. – Jonathan Leffler Nov 25 '12 at 1:44