Buy the book!
|[ < ]||[ > ]||[ << ]||[ Up ]||[ >> ]||[Top]||[Contents]||[Index]||[ ? ]|
You can use the
ctermid function to get a file name that you can
use to open the controlling terminal. In the GNU library, it returns
the same string all the time:
"/dev/tty". That is a special
"magic" file name that refers to the controlling terminal of the
current process (if it has one). To find the name of the specific
terminal device, use
ttyname; see section 17.1 Identifying Terminals.
ctermid is declared in the header file
ctermidfunction returns a string containing the file name of the controlling terminal for the current process. If string is not a null pointer, it should be an array that can hold at least
L_ctermidcharacters; the string is returned in this array. Otherwise, a pointer to a string in a static area is returned, which might get overwritten on subsequent calls to this function.
An empty string is returned if the file name cannot be determined for any reason. Even if a file name is returned, access to the file it represents is not guaranteed.
See also the
ttyname functions, in
17.1 Identifying Terminals.
|webmaster||delorie software privacy|
|Copyright © 2003 by The Free Software Foundation||Updated Jun 2003|