QNX Developer Support
![]() |
![]() |
![]() |
![]() |
cfsetispeed()
Set the input baud rate in a termios structure
Synopsis:
#include <termios.h>
int cfsetispeed( struct termios* termios_p,
speed_t speed );
Arguments:
- termios_p
- A pointer to a termios structure that describes the terminal's control attributes.
- speed
- The new speed. Valid values for speed are defined in <termios.h>.
Library:
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
Description:
The cfsetispeed() function sets the input baud rate within the termios structure pointed to by termios_p to be speed.
You can get a valid termios control structure for an opened device by calling tcgetattr().
![]() |
|
Returns:
- 0
- Success.
- -1
- An error occurred (errno is set).
Errors:
- EINVAL
- One of the arguments is invalid.
- ENOTTY
- This function isn't supported by the system.
Examples:
#include <termios.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdlib.h>
int main( void )
{
int fd;
struct termios termios_p;
speed_t speed;
fd = open( "/dev/ser1", O_RDWR );
tcgetattr( fd, &termios_p);
/*
* Set input baud rate
*/
speed = 9600;
cfsetispeed( &termios_p, speed );
tcsetattr( fd, TCSADRAIN, &termios_p);
close( fd );
return EXIT_SUCCESS;
}
Classification:
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | No |
| Signal handler | Yes |
| Thread | Yes |
See also:
errno, cfgetispeed(), cfgetospeed(), cfsetospeed(), tcgetattr(), tcsetattr(), termios
![]() |
![]() |
![]() |
![]() |

![[Previous]](../prev.gif)
![[Contents]](../contents.gif)
![[Index]](../keyword_index.gif)
![[Next]](../next.gif)

