[En-Nut-Discussion] Quickly flushing input stream
Krzysztof Jankowski
kjankow at o2.pl
Thu Apr 8 09:27:30 CEST 2004
Hi,
how can I quickly clear (flush) an input stream e.x. UART's buffer ?
For output streams there is fflush() function, so what about input ones ?
I'm looking for something like code below, but this seems to suspend a thread when
the stream had been already emptied. Another disadvantage of that solution is a
not necessary loop.
FILE *uart;
int c;
do {
c = fgetc(uart);
} while(c != EOF);
Other possible solution could be to move stream's position to the beginning using
fseek(), but as I read documentation this function isn't implemented yet.
Is there any ioctl() I could use on uart's buffer to do that job ?
ps. I'm using the previous release of NutOS (3.3.1 I hope).
Thanks,
Krzysztof
More information about the En-Nut-Discussion
mailing list