Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 8

ctermid()

Generate the path name of the current controlling terminal

Synopsis:

#include <stdio.h>

char * ctermid( char * s );

Arguments:

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>).

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The ctermid() function generates a string that contains the path name of the current controlling terminal for the calling process.


Note: If the argument s is NULL, the string is built in a static buffer, and the function returns a pointer to the buffer.

Returns:

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.

Examples:

#include <stdio.h>
#include <stdlib.h>

int main( void )
{
  printf( "Controlling terminal is %s\n", ctermid( NULL ) );
  return EXIT_SUCCESS;
}

Classification:

POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Read the Caveats

Caveats:

The ctermid() function isn't thread-safe if the s argument is NULL.

See also:

setsid(), ttyname()


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 145

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/c/ctermid.html on line 145