CTERMID(3S) STANDARD I/O PACKAGE CTERMID(3S)
NAME
ctermid -- generate a terminal file name for the current
process
SYNOPSIS
#include <stdio.h>
char *ctermid(char *s);
DESCRIPTION
ctermid generates the path name of the terminal that con-
trols the current process and stores it in a string.
If s is a NULL pointer, the string is stored in an internal
static area. Its contents are overwritten at the next call
to ctermid and the address is returned. Otherwise, s is
assumed to point to a character array of at least L_ctermid
elements; the path name is placed on this array and the s
value is returned. The L_ctermid constant is defined in the
stdio.h header file.
THREAD-SAFE
- Multi-safe
SEE ALSO
ttyname(3C), pthreads(3T)
NOTES
The difference between ctermid and ttyname(3C) is that tty-
name must be handed a file descriptor and returns the actual
name of the terminal associated with that file descriptor,
while ctermid returns a string (/dev/tty) that refers to the
terminal if used as a file name. Thus, ttyname is useful
only if the process already has at least one file open to a
terminal.
SUPER-UX Last change: Oct 19, 1999 1
G1AB02E Programmer's Reference Manual