Read file

This commit is contained in:
Jake Howard 2017-03-14 22:10:01 +00:00
parent f9163bb683
commit 6a6d9c52e6

View file

@ -1,3 +1,14 @@
fn main() { use std::fs::File;
println!("Hello, world!"); use std::io::Read;
fn read_file(path : &str) -> String {
let mut data = File::open(path).unwrap();
let mut buffer = String::new();
data.read_to_string(&mut buffer);
return buffer;
}
fn main() {
let data = read_file("test.yml");
println!("{:?}", data);
} }