Check input device is a terminal
POSIX only.
import "unistd.h"
fn main() {
let res = isatty(fileno(stdin)) ? "true" : "false";
println "Input device is a terminal? ";
}
Output:
Input device is a terminal? true
Attribution: This is a community solution for the Rosetta Code task Check input device is a terminal in Zen C.
This article uses material from the Rosetta Code article Check input device is a terminal, which is released under the GNU Free Documentation License 1.3. A list of the original authors can be found in the page history.