Задать скорость ввода данных, хранящуюся в структуре termios
#include <termios.h>int cfsetispeed( struct termios *termios_p,speed_t speed );
<termios.h>
.libc
The cfsetispeed() function sets the input baud rate within the struct termios pointed to by termios_p to be speed.
You can get a valid struct termios control structure for an opened device by calling tcgetattr().
![]() |
|
#include <termios.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>int main( void ){int fd;struct termios termios_p;speed_t speed;fd = open( "/dev/ser1", O_RDWR );tcgetattr( fd, &termios_p );/** Set input baud rate*/speed = 9600;cfsetispeed( &termios_p, speed );tcsetattr( fd, TCSADRAIN, &termios_p );close( fd );return (EXIT_SUCCESS);}
POSIX 1003.1
errno, cfgetispeed(), cfgetospeed(), cfsetospeed(), tcgetattr(), tcsetattr(), struct termios
Предыдущий раздел: Описание API системной библиотеки