Exportar (0) Imprimir
Expandir todo
div
eof
Expandir Minimizar

_isatty

Determines whether a file descriptor is associated with a character device.


int _isatty(
   int fd 
);

Parameters

fd

File descriptor referring to the device to be tested.

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

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

This function validates the fd parameter. If fd is a bad file pointer, the invalid parameter handler is invoked, as described in Parameter Validation. If execution is allowed to continue, the function returns 0 and sets errno to EBADF.

Routine Required header Compatibility

_isatty

<io.h>

Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition, Windows Millennium Edition, Windows NT 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003

For more compatibility information, see Compatibility in the Introduction.

All versions of the C run-time libraries.

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

stdout has not been redirected to a file

Adiciones de comunidad

AGREGAR
Mostrar:
© 2014 Microsoft