Skip to content

Instantly share code, notes, and snippets.

@Inari-Whitebear
Created January 12, 2015 16:02
Show Gist options
  • Save Inari-Whitebear/c5ee50db3f29fad8139d to your computer and use it in GitHub Desktop.
Save Inari-Whitebear/c5ee50db3f29fad8139d to your computer and use it in GitHub Desktop.
fn get_file_contents(path: &str) -> IoResult<String> {
let p = Path::new(BASE_PATH.to_string() + path);
let file = try!(File::open_mode(&p, Open, Read));
let read_u8 = try!(file.read_to_end());
let read = try!(std::str::from_utf8(&*read_u8));
Ok(read.to_string())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment