Skip to content

Instantly share code, notes, and snippets.

@deeso
Created May 25, 2014 03:33
Show Gist options
  • Save deeso/7dcb9dabd4aec830461d to your computer and use it in GitHub Desktop.
Save deeso/7dcb9dabd4aec830461d to your computer and use it in GitHub Desktop.
Playing with the rust ffi stuff.
use std::libc::c_int;
use std::io::println;
#[link(name= "r_util")]
extern {
fn r_file_exists(str: &'static str) -> c_int;
}
fn main() {
let p = "/usr/bin/r2";
let x = unsafe {r_file_exists (p)};
println(format!("File Exists: {:d}", x));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment