ptsname() - get name of subordinate (slave) pseudo-terminal device
#include <stdlib.h>
char * ptsname(int fildes)
The ptsname(2) call returns the name of a subordinate (also called slave) pty that corresponds the master pseudo-terminal device indicated by fildes. This call is normally used after opening /dev/ptmx.
The format of the subordinate name is /dev/tty[pqrs]0-9a-f].
On success, ptsname(2) returns a pointer to a string which is the name of the subordinate pseudo terminal. On failure, it returns NULL. (It fails if fildes can't be associated with the master side of a valid pseudo terminal.)
grantpt(2)
open(2)
ttyname(2)
unlockpt(2)
pty(4)
termios(4)
tty(4)