how detect "pressing key"
-
Hi all, I m working with C under linux and i have a little prob :
while(1)
{
if(scanf("%s", msg)>0)
printf("Yr message is %s\n", msg);
else
/* some other Job */
}but when i run the prog it still frozen waiting for the message but i wanna it do the other Job bloc. So is there any function that helps me detecting if there is a key pressed or no ??? Thx.
"The Ultimate Limit Is Only Your Imagination."
-
Hi all, I m working with C under linux and i have a little prob :
while(1)
{
if(scanf("%s", msg)>0)
printf("Yr message is %s\n", msg);
else
/* some other Job */
}but when i run the prog it still frozen waiting for the message but i wanna it do the other Job bloc. So is there any function that helps me detecting if there is a key pressed or no ??? Thx.
"The Ultimate Limit Is Only Your Imagination."
I guess scanf is always returning a value > 0 in ur code. You would want to use a getch() like function to detect keypress rather than scanf. Check this out http://cboard.cprogramming.com/archive/index.php/t-27714.html[^]
------------------------------------------- It's code that drives you - Shyam