how to flush stdin buffer in linux

richard -rw- weinberger richard.weinberger at gmail.com
Tue Jan 8 12:53:15 EST 2013


On Tue, Jan 8, 2013 at 6:20 PM, Niroj Pokhrel <nirojpokhrel at gmail.com> 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
> operation).
> Thanx in advance.

fflush(stdin) is undefined.

-- 
Thanks,
//richard



More information about the Kernelnewbies mailing list