|
Ambitious contributor
|
|
| 10Mar2010,17:02 | #11 |
|
Ambitious contributor
|
|
| 10Mar2010,17:36 | #12 |
|
Mentor
|
![]() |
| 10Mar2010,17:56 | #13 |
|
Use getch() from the ncurses library.
|
|
Ambitious contributor
|
|
| 10Mar2010,18:28 | #14 |
|
Mentor
|
![]() |
| 11Mar2010,00:56 | #15 |
|
Try Google.
|
|
Ambitious contributor
|
|
| 11Mar2010,11:10 | #16 |
|
Mentor
|
![]() |
| 11Mar2010,19:04 | #17 |
|
Alright then, if you want it spoon-fed to you, how about:
Code:
int c=getch(); Code:
printf("%d\n",c);
Code:
int c=getch();
if (c==CODE_FOR_E)
{
printf("User pressed E\n");
}
|
|
Ambitious contributor
|
|
| 11Mar2010,19:33 | #18 |
|
I have no intention of getting flamed now ..he he
.And Thanks for putting together that code yeah but I'm doing it by using threads.
|
|
Go4Expert Member
|
|
| 11Mar2010,20:35 | #19 |
|
you will need the thread that will moniter the char to stop the printing . Create the new thread and use getchar( ) in that thread this will continue with the printing . till you press 'e' or 'E' .
|
|
Pro contributor
|
![]() |
| 12Mar2010,16:39 | #20 |
|
this can be solved like this
Code:
#include<stdio.h>
#include<conio.h>
int main(){
int i=0;
printf("enter key a to stop running");
char a='o';
while(a!='a'){
while(!kbhit()){
printf("\n%d",++i);
}
a=getch();
}
printf("\nyou pressed a and stopped the process!!!");
getchar();
}
|



Ok thanks for that advice.Any one else who can help but not be so discreet would be appreciated.
.And Thanks for putting together that code yeah but I'm doing it by using threads.
