![]() |
![]() |
![]() |
Return the output baud rate that is stored in a termios structure
#include <termios.h> speed_t cfgetospeed( const struct termios* termios_p );
libc
The cfgetospeed() function returns the output baud rate that is stored in the termios structure pointed to by termios_p.
A valid termios control structure for an opened device can be obtained using the tcgetattr() function.
The output baud rate stored in *termios_p, or -1 if an error occurs (errno is set).
#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 output baud rate */ speed = cfgetospeed( &termios_p); printf( "Output baud: %ld\n", speed ); close( fd ); return EXIT_SUCCESS; }
Safety: | |
---|---|
Cancellation point | No |
Interrupt handler | Yes |
Signal handler | Yes |
Thread | Yes |
errno, cfgetispeed(), cfsetispeed(), cfsetospeed(), tcgetattr(), tcsetattr()
![]() |
![]() |
![]() |