tcsetattr()

set terminal file descriptor parameters 

Function


SYNOPSIS

#include <termios.h>

int tcsetattr(int fildes, int optional_actions, const struct termios *termios_p);


DESCRIPTION

The tcsetattr() function sets the parameters associated with the terminal referred to by the specified file descriptor from the termios structure, according to the following requested action:

TCSANOW  

The change occurs immediately.

TCSADRAIN  

The change occurs after all output written to the file descriptor has been transmitted. This action should be used when changing parameters that affect output.

TCSAFLUSH  

The change occurs after all output written to the file descriptor has been transmitted, and all input so far received but not read is discarded before the change is made.

The tcsetattr() function returns successfully if it was able to perform any of the requested actions, even if some of the requested actions could not be performed. It sets all the attributes that are supported for the device as requested, and leaves all attributes not supported unchanged. If no part of the request can be completed, tcsetattr() returns -1 and sets errno to EINVAL. A subsequent call to tcgetattr() returns the actual state of the terminal device (reflecting both the changes made and not made in the previous tcsetattr() call). The tcsetattr() function does not change the values in the termios structure whether or not it actually accepts them.

The effect of tcsetattr() is undefined if the value of the termios structure is not derived from the result of a call to tcgetattr() on the specified file descriptor. An application should modify only the fields and flags defined in this manual between the call to tcgetattr() and tcsetattr(), leaving all other fields and flags unmodified.


PARAMETERS

fildes 

Is a file descriptor that must refer to a terminal.

optional_actions 

An option that must be one of the following: TCSANOW, TCSADRAIN, TCSAFLUSH.

termios_p 

Points to a location in the termios structure.


RETURN VALUES

If successful, tcsetattr() returns a value of zero. Otherwise, it returns -1 and sets errno to the one of the following values:

EBADF 

The fildes parameter is not a valid file descriptor.

EINTR 

A signal interrupted the call.

EINVAL 

The optional_actions parameter is not a proper value, or an attempt was made to change an attribute represented in the termios structure to an unsupported value.

ENOTTY 

The file associated with fildes is not a terminal.


CONFORMANCE

POSIX.1 (1996).


MULTITHREAD SAFETY LEVEL

Async-signal-safe.


PORTING ISSUES

None.


AVAILABILITY

PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


SEE ALSO

Functions:
ioctl(), tcgetattr()

Miscellaneous:
struct termios


PTC MKS Toolkit 10.4 Documentation Build 39.