Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

_isatty

int _isatty(
   int fd 
);

Parameter

fd
File descriptor referring to device to be tested.

Return Value

_isatty returns a nonzero value if the descriptor is associated with a character device. Otherwise, _isatty returns 0.

Remarks

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

Requirements

Routine Required header Compatibility
_isatty <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

Example

// crt_isatty.c
/* This program checks to see whether
 * stdout has been redirected to a file.
 */

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

int 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");
}

Sample Output

stdout has not been redirected to a file

See Also

File Handling Routines | Run-Time Routines and .NET Framework Equivalents

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.