Сгенерировать путь для текущего управляющего терминала
#include <stdio.h>char * ctermid( char *s );
NULL
, or a pointer to a buffer in which the function can store the path name of the controlling terminal. This string should be at least L_ctermid characters long (see <stdio.h>
).libc
The ctermid() function generates a string that contains the path name of the current controlling terminal for the calling process.
![]() | If the argument s is NULL , the string is built in a static buffer, and the function returns a pointer to the buffer. |
A pointer to the path name of the controlling terminal, or a pointer to a null string if the function can't locate the controlling terminal.
#include <stdio.h>#include <stdlib.h>int main( void ){printf( "Controlling terminal is %s\n", ctermid( NULL ) );return (EXIT_SUCCESS);}
POSIX 1003.1
The ctermid() function isn't thread-safe if the s argument is NULL
.
Предыдущий раздел: Описание API системной библиотеки