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);
posted @ 2021-10-14 16:04  飞翔的可乐!  阅读(1331)  评论(0)    收藏  举报