termios(3P) INTERACTIVE UNIX System (POSIX) termios(3P)
NAME
termios: cfgetispeed, cfgetospeed, cfsetispeed, cfsetospeed
- baud rate functions
SYNOPSIS
#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;
DESCRIPTION
The following interfaces are provided for getting and set-
ting the values of the input and output baud rates in the
termios structure. The effects on the terminal device
described below do not become effective until the
tcsetattr() function is successfully called.
The input and output baud rates are stored in the termios
structure. The values shown in the following table are sup-
ported. The name symbols in this table are defined in
<termios.h>.
termios Baud Rate Values
Name Description Name Description
B0 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 is 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 ter-
mios structure pointed to by termios_p to speed. The zero
baud rate, B0, is used to terminate the connection. If B0
is specified, the modem control lines shall no longer be
Rev. 1.1 Page 1
termios(3P) INTERACTIVE UNIX System (POSIX) termios(3P)
asserted. Normally, this will disconnect the line.
cfgetispeed() returns the input baud rate stored in the ter-
mios 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 will be specified by the value of the
output baud rate. Both cfsetispeed() and cfsetospeed()
return a value of zero if unsuccessful and -1 to indicate an
error. Attempts to set unsupported baud rates shall be
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.
SEE ALSO
tcgetattr(3P).
Rev. 1.1 Page 2