Middleware, development tools, realtime operating system
software and services for superior embedded design


Home
QNX Community Resources
Developer Support
QNX Documentation Library
QNX Developer Support

QNX Developer Support

QNX Software Systems
Developer Resources
Blogs
Board support packages
Foundry27 projects
Forums
Hardware support listing
Online video tutorials
Product documentation
Technical Articles

[Previous] [Contents] [Index] [Next]

isatty()

Test to see if a file descriptor is associated with a terminal

Synopsis:

#include <unistd.h>

int isatty( int fildes );

Arguments:

fildes
The file descriptor that you want to test.

Library:

libc

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

Description:

The isatty() function allows the calling process to determine if the file descriptor fildes is associated with a terminal.

Returns:

0
The fildes file descriptor doesn't refer to a terminal.
1
The fildes file descriptor refers to a terminal.

Examples:

/*
 * The following program exits with a status of
 * EXIT_SUCCESS if stderr is a tty; otherwise,
 * EXIT_FAILURE
 */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int main( void )
  {
    return( isatty( 3 ) ? EXIT_SUCCESS : EXIT_FAILURE );
  }

Classification:

POSIX 1003.1

Safety:
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes

See also:

open()


[Previous] [Contents] [Index] [Next]