波特率的设置通常是使用cfsetospeed和cfsetispeed功能。变波特率信息通过cfgetispeed和cfgetospeed功能做了。



cfsetospeed功能



标题:



#包括



函数原型:



Int cfsetospeed(struct termios * termptr,speed_t速度);



参数:



struct termios * termptr -指向termios结构



speed_t速度输出波特率,需要设置



返回值:



如果成功返回0,返回到1。



cfsetispeed功能



标题:



#包括



函数原型:



Int cfsetispeed(struct termios * termptr,speed_t速度);



参数:



struct termios * termptr -指向termios结构



speed_t速度输入波特率,需要设置



返回值:



如果成功返回0,返回到1。



cfgetospeed功能



标题:



#包括



函数原型:



speed_t cfgetospeed(指向termios结构的指针* termptr);



参数:



指向termios结构的指针,指向termios结构



返回值:



返回输出波特率



cfgetispeed功能



标题:



#包括



函数原型:



speed_t cfgetispeed(指向termios结构的指针* termptr);



参数:



指向termios结构的指针* termptr -指向termios结构



返回值:



返回输入波特率



波特率常数:



cbaud面具



B0 0波特



B50 50波特



75波特B75



100波特B110



134波特B134



B150 150波特



B200 200波特



B300 300波特



b600 600波特



b1200 1200波特



b1800 1800波特



b2400 2400波特



b9600 9600波特



b19200 19200波特



b38400 38400波特



b57600 57600波特



b115200 115200波特