Rust libc: Difference between revisions

From wikinotes
(Created page with "libc bindings = Documentation = <blockquote> {| class="wikitable" |- | crates.io || https://crates.io/crates/libc |- | github | https://github.com/rust-lang/libc |- |} </blockquote><!-- Documentation --> = Install = <blockquote> <syntaxhighlight lang="toml"> # Cargo.toml [dependencies] libc = "0.2" </syntaxhighlight> </blockquote><!-- Install -->")
 
No edit summary
 
Line 7: Line 7:
| crates.io || https://crates.io/crates/libc
| crates.io || https://crates.io/crates/libc
|-
|-
| github | https://github.com/rust-lang/libc
| github || https://github.com/rust-lang/libc
|-
|-
|}
|}
Line 21: Line 21:
</syntaxhighlight>
</syntaxhighlight>
</blockquote><!-- Install -->
</blockquote><!-- Install -->
= Usage =
<blockquote>
<syntaxhighlight lang="rust">
extern crate libc;
fn stdin_is_tty() -> bool {
    unsafe { libc::isatty(0) != 0 }
}
</syntaxhighlight>
</blockquote><!-- Usage -->

Latest revision as of 08:14, 9 February 2023

libc bindings

Documentation

crates.io https://crates.io/crates/libc
github https://github.com/rust-lang/libc

Install

# Cargo.toml

[dependencies]
libc = "0.2"

Usage

extern crate libc;

fn stdin_is_tty() -> bool {
    unsafe { libc::isatty(0) != 0 }
}