All of lore.kernel.org
 help / color / mirror / Atom feed
From: tobias@gambas-buch.de (Tobias Boege)
To: kernelnewbies@lists.kernelnewbies.org
Subject: how to flush stdin buffer in linux
Date: Tue, 8 Jan 2013 20:53:44 +0100	[thread overview]
Message-ID: <20130108195344.GA530@aurora> (raw)
In-Reply-To: <CAKzXvN-iB=eg694jEvB_poucxZbwArTvT+Ym_O1dPkg5TuL04w@mail.gmail.com>

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

  parent reply	other threads:[~2013-01-08 19:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2013-01-09  9:20   ` beyond.hack
2013-01-09 23:46     ` richard -rw- weinberger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130108195344.GA530@aurora \
    --to=tobias@gambas-buch.de \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.