ttyname()

get path name of terminal 

Function


SYNOPSIS

#include <unistd.h>

char *ttyname(int fildes);


DESCRIPTION

The ttyname() function returns a pointer to a string that contains a null-terminated path name of the terminal associated with the file descriptor fildes. The return value of ttyname() may point to static data that is overwritten by each call.


PARAMETERS

fildes 

Is the file descriptor that associates with the string containing the null-terminated path name of the terminal.


RETURN VALUES

On success, ttyname() returns a pointer to a string. On error, a null pointer is returned, and errno is set to one of the following values:

EBADF 

fildes is not a valid file descriptor.

ENOTTY 

fildes does not refer to a terminate device.


CONFORMANCE

UNIX 98.


MULTITHREAD SAFETY LEVEL

Unsafe.


PORTING ISSUES

ttyname() returns /dev/tty/nnn, where nnn is the process group ID.


AVAILABILITY

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


SEE ALSO

Functions:
ctermid(), isatty(), ttyname_r()


MKS Toolkit 9.2 Documentation Build 16.