Your Browser is not longer supported
Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...
{{viewport.spaceProperty.prod}}
ctermid - generate pathname for controlling terminal
&pagelevel(4)&pagelevel
Syntax | #include <stdio.h> char *ctermid(char *s); |
Description | ctermid() generates a string that, when used as a pathname, refers to the current controlling terminal for the current process.
If s is a null pointer, the string is generated in an internal static area that is overwritten by the each call to ctermid() , and the address of this area is returned. Otherwise, s is assumed to point to a character array of at least L_ctermid elements; the pathname is placed in this array and the value of s is returned. The symbolic constant L_ctermid is defined in the header file stdio.h . |
Return val. | In non-conformance with the XPG4 standard, /dev/tty is always returned. |
Notes | The difference between ctermid() and ttyname() is that ttyname() must be handed a file descriptor and returns the pathname of the terminal associated with that file descriptor, while ctermid() returns a string (such as /dev/tty ) that will refer to the current controlling terminal if used as a pathname. In other words, ttyname() is only useful if the process has already opened at least one file for a terminal. |
See also | ttyname() , stdio.h .
|