_isatty

Visual Studio 6.0

int _isatty( int handle );

Routine Required Header Compatibility
_isatty <io.h> Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

_isatty returns a nonzero value handle is associated with a character device. Otherwise, _isatty returns 0.

Parameter

handle

Handle referring to device to be tested

Remarks

The _isatty function determines whether handle is associated with a character device (a terminal, console, printer, or serial port).

Example

/* ISATTY.C: This program checks to see whether
 * stdout has been redirected to a file.
 */

#include <stdio.h>
#include <io.h>

void main( void )
{
   if( _isatty( _fileno( stdout ) ) )
      printf( "stdout has not been redirected to a file\n" );
   else
      printf( "stdout has been redirected to a file\n");
}

Output

stdout has been redirected to a file

File Handling Routines

Show: