* @brief Flushes data from a terminal input or output queue. * @param fd File descriptor of the terminal device. * @param queue Queue to be flushed (TCIFLUSH, TCOFLUSH, or TCIOFLUSH). * @return Upon successful completion, returns 0; otherwise, returns -1 and sets errno to indicate the error. * * @note This function flushes data from the input or output queue of the terminal device s
| 195 | * If the ioctl operation fails, errno is set to indicate the error, and the function returns -1. |
| 196 | */ |
| 197 | int tcflush(int fd, int queue) |
| 198 | { |
| 199 | return ioctl(fd, TCFLSH, (void*)(rt_ubase_t)queue); |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * @brief Controls the terminal flow control. |