try fflush(stdin);

cheers
rishi


On Tue, 25 Sep 2001, Logu wrote:

> When I compile and run the following code. The program prompts for the user
> input for the first scanf(), but instead of receiving input for the
> c=getchar(), it takes the enter key from the scanf and the program is
> executed wtihout waiting for the user input. Some one please give me some
> clues to avoid this. Is there any function which does the job of dos getch()
> (ie without echoing the input on the screen.).
> 
> 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);
> }
> 
> 
> 
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> _______________________________________________
> linux-india-help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux-india-help
> 


_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help

Reply via email to