isatty
Go Up to io.h Index
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
#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++ |
---|---|---|---|
+ |
+ |