* how to flush stdin buffer in linux
@ 2013-01-08 17:20 Niroj Pokhrel
2013-01-08 17:53 ` richard -rw- weinberger
2013-01-08 19:53 ` Tobias Boege
0 siblings, 2 replies; 5+ messages in thread
From: Niroj Pokhrel @ 2013-01-08 17:20 UTC (permalink / raw)
To: kernelnewbies
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130108/6ffc5ec5/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* how to flush stdin buffer in linux
2013-01-08 17:20 how to flush stdin buffer in linux Niroj Pokhrel
@ 2013-01-08 17:53 ` richard -rw- weinberger
2013-01-08 19:53 ` Tobias Boege
1 sibling, 0 replies; 5+ messages in thread
From: richard -rw- weinberger @ 2013-01-08 17:53 UTC (permalink / raw)
To: kernelnewbies
On Tue, Jan 8, 2013 at 6:20 PM, Niroj Pokhrel <nirojpokhrel@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
^ permalink raw reply [flat|nested] 5+ messages in thread
* how to flush stdin buffer in linux
2013-01-08 17:20 how to flush stdin buffer in linux Niroj Pokhrel
2013-01-08 17:53 ` richard -rw- weinberger
@ 2013-01-08 19:53 ` Tobias Boege
2013-01-09 9:20 ` beyond.hack
1 sibling, 1 reply; 5+ messages in thread
From: Tobias Boege @ 2013-01-08 19:53 UTC (permalink / raw)
To: kernelnewbies
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
> operation).
> Thanx in advance.
If it's a tty, you may want to use tcflush(fd, TCIFLUSH);
Regards,
Tobi
^ permalink raw reply [flat|nested] 5+ messages in thread
* how to flush stdin buffer in linux
2013-01-08 19:53 ` Tobias Boege
@ 2013-01-09 9:20 ` beyond.hack
2013-01-09 23:46 ` richard -rw- weinberger
0 siblings, 1 reply; 5+ messages in thread
From: beyond.hack @ 2013-01-09 9:20 UTC (permalink / raw)
To: kernelnewbies
you may try with
__fpurge()
On Wed, Jan 9, 2013 at 1:23 AM, Tobias Boege <tobias@gambas-buch.de> wrote:
> 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
> > operation).
> > Thanx in advance.
>
> If it's a tty, you may want to use tcflush(fd, TCIFLUSH);
>
> Regards,
> Tobi
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
--
Regards,
saurabh
http://about.me/shandilyasaurabh
www.beyondszine.wordpress.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20130109/7d9df827/attachment.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-01-09 23:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-08 17:20 how to flush stdin buffer in linux Niroj Pokhrel
2013-01-08 17:53 ` richard -rw- weinberger
2013-01-08 19:53 ` Tobias Boege
2013-01-09 9:20 ` beyond.hack
2013-01-09 23:46 ` richard -rw- weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).