Generates the path name of the controlling terminal.
#include <stdio.h> char *ctermid (String) char *String;
The ctermid subroutine generates the path name of the controlling terminal for the current process and stores it in a string.
Note: File access permissions depend on user access. Access to a file whose path name the ctermid subroutine has returned is not guaranteed.
The difference between the ctermid and ttyname subroutines is that the ttyname subroutine must be handed a file descriptor and returns the actual name of the terminal associated with that file descriptor. The ctermid subroutine returns a string (the /dev/tty file) that refers to the terminal if used as a file name. Thus, the ttyname subroutine is useful only if the process already has at least one file open to a terminal.
This subroutine is part of Base Operating System (BOS) Runtime.
The isatty or ttyname subroutine.
Input and Output Handling Programmer's Overview in AIX Version 4.3 General Programming Concepts: Writing and Debugging Programs.