LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   flush the serial buffer (https://www.linuxquestions.org/questions/linux-general-1/flush-the-serial-buffer-403127/)

fizgig10 01-13-2006 08:08 PM

flush the serial buffer
 
I want to flush the serial buffer before I read from it (monitor it for the next transmission). Is this possible?

maus 09-21-2009 03:29 AM

If you initialize and configure the serial device with tcsetattr() you can flush the serial buffer by setting the new tio with the TCSAFLUSH Parameter:

Code:

    tcsetattr(fileDescriptor, TCSAFLUSH, &myNewTTYoptions);
See POSIX Serial Programming Guide for details.

PS: I made this tardy replay, since this post shows up as result number one while googeling for "flush serial buffer".


All times are GMT -5. The time now is 04:32 PM.