Вернуть скорость ввода данных, хранящуюся в структуре termios
#include <termios.h>speed_t cfgetispeed( const struct termios *termios_p );
libc
The cfgetispeed() function returns the input baud rate that's stored in the struct termios pointed to by termios_p.
You can get a valid struct termios control structure for an opened device by calling tcgetattr().
The input baud rate stored in *termios_p.
Если возникла ошибка функция возвращает -1
, код ошибки записывается в errno.
#include <termios.h>#include <fcntl.h>#include <unistd.h>#include <stdlib.h>#include <stdio.h>int main( void ){int fd;struct termios termios_p;speed_t speed;fd = open( "/dev/ser1", O_RDWR );tcgetattr( fd, &termios_p );/** Get input baud rate*/speed = cfgetispeed( &termios_p );printf( "Input baud: %ld\n", speed );close( fd );return (EXIT_SUCCESS);}
POSIX 1003.1
errno, cfgetospeed(), cfsetispeed(), cfsetospeed(), tcgetattr(), tcsetattr(), struct termios
Предыдущий раздел: Описание API системной библиотеки