archive
/
ymd
Archived
1
Fork 0

Read file

This commit is contained in:
Jake Howard 2017-03-14 22:10:01 +00:00
parent f9163bb683
commit 6a6d9c52e6
1 changed files with 13 additions and 2 deletions

View File

@ -1,3 +1,14 @@
fn main() {
println!("Hello, world!");
use std::fs::File;
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);
}