Created
May 25, 2014 03:33
-
-
Save deeso/7dcb9dabd4aec830461d to your computer and use it in GitHub Desktop.
Playing with the rust ffi stuff.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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