how to flush stdin buffer in linux
tobias at gambas-buch.de
Tue Jan 8 14:53:44 EST 2013
On Tue, 08 Jan 2013, Niroj Pokhrel wrote:
> Hi all,
> I tried to use fflush(stdin) in gcc as I used to in other compilers. But It
> didn't clear my buffer so I am wondering how can I clear the stdin buffer
> in GCC.
> I tried using lseek but got -EPIPE (as tty devices doesn't support lseek
> Thanx in advance.
If it's a tty, you may want to use tcflush(fd, TCIFLUSH);
More information about the Kernelnewbies