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/ttyname.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/ttyname.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/ttyname.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/ttyname.html on line 8
Get a fully qualified pathname for a file
#include <unistd.h>
char *ttyname( int fildes );
- fildes
- A file descriptor that's associated with the file whose name you want
to get.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The ttyname() function returns a pointer to a static buffer
that contains a fully qualified pathname associated with the file
associated with fildes.
A pointer to the pathname for
fildes, or NULL if an error occurred
(errno is set).
- EAGAIN
- The device driver was in use by another process, or the driver was
unable to carry out the request due to an outstanding command in progress.
- EBADF
- The fildes argument isn't a valid file descriptor.
- EINTR
- The function was interrupted by a signal.
- ENOSYS
- The ttyname() function
isn't implemented for the filesystem specified
by filedes.
- ENOTTY
- The fildes argument doesn't refer to a tty.
- EPERM
- The process doesn't have sufficient permission to carry out the requested
command.
/*
* The following program prints out the name
* of the terminal associated with stdin.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( void )
{
if( isatty( 0 ) ) {
printf( "%s\n", ttyname( 0 ) );
} else {
printf( "\n" );
}
return EXIT_SUCCESS;
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
No |
Thread |
No |
ctermid(),
setsid(),
ttyname_r()
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/ttyname.html on line 171
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/ttyname.html on line 171