|
|
#include <termios.h>speed_t cfgetospeed (termios_p) struct termios *termios_p;
int cfsetospeed (termios_p, speed) struct termios *termios_p; speed_t speed;
speed_t cfgetispeed (termios_p) struct termios *termios_p;
int cfsetispeed (termios_p, speed) struct termios *termios_p; speed_t speed;
The input and output baud rates are stored in the termios structure. The values shown in the following table are supported. The name symbols in this table are defined in <termios.h>.
Name | Description | Name | Description |
---|---|---|---|
BO | Hang up | B600 | 600 baud |
B50 | 50 baud | B1200 | 1200 baud |
B75 | 75 baud | B1800 | 1800 baud |
B110 | 110 baud | B2400 | 2400 baud |
B134 | 134.5 baud | B4800 | 4800 baud |
B150 | 150 baud | B9600 | 9600 baud |
B200 | 200 baud | B19200 | 19200 baud |
B300 | 300 baud | B38400 | 38400 baud |
The type speed_t is defined in <termios.h> and as an unsigned integral type.
The termios_p argument is a pointer to a termios structure. cfgetospeed returns the output baud rate stored in the termios structure pointed to by termios_p.
cfsetospeed sets the output baud rate stored in the termios structure pointed to by termios_p to speed. The zero baud rate, BO, is used to terminate the connection. If BO is specified, the modem control lines are no longer asserted. Normally, this disconnects the line.
cfgetispeed returns the input baud rate stored in the termios structure.
cfsetispeed sets the input baud rate stored in the termios structure to speed. If the input baud rate is set to zero, the input baud rate is specified by the value of the output baud rate. Both cfsetispeed and cfsetospeed return a value of zero if successful and -1 to indicate an error. Attempts to set unsupported baud rates are ignored, and it is implementation-defined whether an error is returned by any or all of cfsetispeed, cfsetospeed, or tcsetattr. This refers both to changes to baud rates not supported by the hardware, and to changes setting the input and output baud rates to different values if the hardware does not support this.
IEEE POSIX Std 1003.1-1990 System Application Program Interface (API) [C Language] (ISO/IEC 9945-1)
;
and
NIST FIPS 151-1
.