hi Abhijeet,

Try
fflush(stdin);

Regards
Hitesh





-----Original Message-----
From: shadyabhi <[email protected]>
To: [email protected]
Sent: Wed, Feb 3, 2010 1:37 pm
Subject: [c-prog] How do I flush input stream?


 

fflush() is only used for flushing OUTPUT buffer. But how do I flush 
input buffer?

One way is using:-

while ((ch = getchar()) != '\n' && ch != EOF);

IS there any OTHER WAY?

I also tried using library function:- setbuf(stdin,NULL);
but no success..

Why?

-- 
Abhijeet Rastogi
(shadyabhi)
http://www.google.com/profiles/abhijeet.1989

[Non-text portions of this message have been removed]







[Non-text portions of this message have been removed]

Reply via email to