Check output device is a terminal: Difference between revisions

→‎{{header|Rust}}: Updated to the Rust 1.2.0
(J)
(→‎{{header|Rust}}: Updated to the Rust 1.2.0)
Line 235:
</lang>
=={{header|Rust}}==
<lang rust>/* Rust 0.9 version. Uses C library interface */
 
extern mod std;
useextern crate std::libc;
 
fn main() {
let istty = unsafe { libc::isatty(libc::STDOUT_FILENO as i32) } != 0;
if (istty) {
println!("stdout is tty");
} else {
println!("stdout is not tty");
}
}</lang>