The way it is written, getchar() is looking at last, that is "enter"
keystroke. If you
convert int to char and read the char array using getchar(), it should
read the input character by character; if that is what you want.
Vijay
Logu wrote:
> I actually want to check for the enter key strokes and act accordingly. But
> previous keystrokes gets into this and troubles. Please tell me how to avoid
> that? Is it enough to check for the int value 10 for enterkey stroke.
> -Logu
>
> #include<stdio.h>
> int main(void){
>
> char c;
> int i;
> printf("\nEnter a number: ");
> scanf("%d",&i);
>
> if(c=getchar()!='n')
> printf("\ntest ok %c\n",c);
> }
----------------------------------
The dumb machine does what I tell it to do; not what I want it to do.
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help