串口通信错误之后 可以用tcflush清除缓冲区 以防止一直出错!

来源:互联网 发布:dyndns.org 域名申请 编辑:程序博客网 时间:2024/04/27 17:03

tcflush(int fd, int queue_selector)  

discards data written to the object referred to by fd but not transmitted, or data received but not read, depending on the value of
       queue_selector:

       TCIFLUSH
              flushes data received but not read.

       TCOFLUSH
              flushes data written but not transmitted.

       TCIOFLUSH
              flushes both data received but not read, and data written but not transmitted.

原创粉丝点击