Task

Demonstrate how to check whether the input device is a terminal or not.



Related task

   Check output device is a terminal


#include <unistd.h>	//for isatty()
#include <stdio.h>	//for fileno()
 
int main(void)
{
	puts(isatty(fileno(stdin))
		? "stdin is tty"
		: "stdin is not tty");
	return 0;
}