Check input device is a terminal: Difference between revisions

Content added Content deleted
(→‎{{header|Rust}}: Updated to the Rust 1.2.0)
(→‎{{header|Rust}}: Switched STDOUT to STDIN)
Line 213: Line 213:


fn main() {
fn main() {
let istty = unsafe { libc::isatty(libc::STDOUT_FILENO as i32) } != 0;
let istty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0;
if istty {
if istty {
println!("stdout is tty");
println!("stdout is tty");