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.
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
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
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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- Regards, saurabh http://about.me/shandilyasaurabh www.beyondszine.wordpress.com
participants (4)
-
beyond.hack -
Niroj Pokhrel -
richard -rw- weinberger -
Tobias Boege