ttyname(3C) ttyname(3C)
NAME
ttyname, isatty - find name of a terminal
SYNOPSIS
char *ttyname (fildes)
int fildes;
int isatty (fildes)
int fildes;
DESCRIPTION
ttyname returns a pointer to a string containing the null-
terminated path name of the terminal device associated with
file descriptor fildes.
Isatty returns 1 if fildes is associated with a terminal
device, 0 otherwise.
FILES
/dev/*
DIAGNOSTICS
ttyname returns a NULL pointer if fildes does not describe a
terminal device in directory /dev.
If isatty returns 0, errno will be set to indicate the rea-
son:
[EBADF] the fildes argument is not a valid open file
descriptor, or
[ENOTTY] the fildes argument is not associated with a
terminal.
NOTES
The return value of ttyname points to static data whose con-
tent is overwritten by each call.
Page 1 CX/UX Programmer's Reference Manual