tcflush() 清空串口數據函數


1、tcflush() 函數包含於頭文件#include <termios.h>;
2、函數原型:int tcflush(int fd, int queue_selector);

#include <termios.h> //頭文件

/*
 * fd           // 終端I/O打開的句柄
 * queue_selector     // 控制tcflush的操作,取值為下面三個常數中的一個
 *     TCIFLUSH       // 清除正收到的數據,且不會讀取出來。
 *     TCOFLUSH       // 清除正寫入的數據,且不會發送至終端。
 *     TCIOFLUSH      // 清除所有的緩存數據。
 *
 * 返回值: 0成功; -1失敗,並且為 errno 置值來指示錯誤
 */
int tcflush(int fd, int queue_selector);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM