Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 8
Change the terminal control settings for a device
#include <termios.h>
int tcsetattr( int fildes,
int optional_actions,
const struct termios *termios_p );
- fildes
- The file descriptor associated with the terminal device.
- termios_p
- A pointer to a
termios
structure that describes the attributes that you want to set for the
terminal device.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The tcsetattr() function sets the current terminal control settings
for the opened device indicated by fildes to the values
stored in the structure pointed to by termios_p.
The operation of tcsetattr() depends on the values in
optional_actions:
- TCSANOW
- The change is made immediately.
- TCSADRAIN
- No change is made until all currently written data has been
transmitted.
- TCSAFLUSH
- No change is made until all currently written data has been
transmitted, at which point any received but unread data is also
discarded.
The termios control structure is defined in
<termios.h>.
For more information, see
tcgetattr().
- 0
- Success.
- -1
- An error occurred; errno is set.
- EBADF
- The argument fildes is invalid;
- EINVAL
- The argument action is invalid, or one of the
members of termios_p is invalid.
- ENOSYS
- The resource manager associated with fildes doesn't support
this call.
- ENOTTY
- The argument fildes doesn't refer to a terminal device.
#include <stdlib.h>
#include <termios.h>
int raw( int fd )
{
struct termios termios_p;
if( tcgetattr( fd, &termios_p ) )
return( -1 );
termios_p.c_cc[VMIN] = 1;
termios_p.c_cc[VTIME] = 0;
termios_p.c_lflag &= ~( ECHO|ICANON|ISIG|
ECHOE|ECHOK|ECHONL );
termios_p.c_oflag &= ~( OPOST );
return( tcsetattr( fd, TCSADRAIN, &termios_p ) );
}
int unraw( int fd )
{
struct termios termios_p;
if( tcgetattr( fd, &termios_p ) )
return( -1 );
termios_p.c_lflag |= ( ECHO|ICANON|ISIG|
ECHOE|ECHOK|ECHONL );
termios_p.c_oflag |= ( OPOST );
return( tcsetattr( fd, TCSADRAIN, &termios_p ) );
}
int main( void )
{
raw( 0 );
/*
* Stdin is now "raw"
*/
unraw ( 0 );
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno,
ioctl(),
select(),
tcgetattr(),
termios
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 232
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/tcsetattr.html on line 232