Hi,
This should go to LIP.
In any case, maybe I can help here.
The problem is occurring as '\n' remains in stdin when you take input
using scanf with %c.
So, before the line in which you are taking input, write this:
scanf("*[\n]"); /*This clears the buffer*/
/*Then you write*/
scanf("%c",&var); /*This takes the input*/
This will clear stdin and should solve your problem.
Also remember, ffush(stdin) is wrong C. fflush is used with stdout and
of course other FILE *fp. But using fflush with stdin is wrong and gives
you undefined result.
Hope it helps
Cheers
Arko
On Wed, 2003-06-04 at 15:28, yogesh raju wrote:
>
>
> hai
>
> char var;
> scanf("%c",&var);
>
> when i use scanf or even getchar to get a character in a loop, during
> first iteration i get no problem, but during second iteration it's not
> waiting for my input. I tried out fflush(stdin) it's not working. I get no
> problem when I use two scanf or getchar statements continuously.
>
> Please help me.
>
> _________________________________________________________________
> Want free fuel? Get IOC Citibank card.
> http://server1.msn.co.in/msnleads/citibankcards/ioc.asp Drive your dreams!
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: Etnus, makers of TotalView, The best
> thread debugger on the planet. Designed with thread debugging features
> you've never dreamed of, try TotalView 6 free at www.etnus.com.
> _______________________________________________
> linux-india-help mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/linux-india-help
-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The best
thread debugger on the planet. Designed with thread debugging features
you've never dreamed of, try TotalView 6 free at www.etnus.com.
_______________________________________________
linux-india-help mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/linux-india-help