RAD Studio |  |

isatty

Header File

io.h

Category

Input/output Routines

Prototype

int isatty(int handle);

Description

Checks for device type.

isatty determines whether handle is associated with any one of the following character devices:

- a terminal
- a console
- a printer
- a serial port

Return Value

If the device is one of the four character devices listed above, isatty returns a nonzero integer. If it is not such a device, isatty returns 0.

Example

Copy Code

    #include <stdio.h>
    #include <io.h>
    int main(void)
    {
        int handle;
        handle = fileno(stdout);
        if (isatty(handle))
           printf("Handle %d is a device type\n", handle);
        else
           printf("Handle %d isn't a device type\n", handle);
        return 0;
    }

Portability

POSIX | Win32 | ANSI C | ANSI C++
+ | + |  |

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!