rustlings/exercises/stdio/readfile1.rs
2020-07-30 15:59:08 +05:00

14 lines
308 B
Rust

//readfile1.rs
// Make me compile! Execute `rustlings hint readfile1` for hints
use std::fs::File;
fn main() {
let path = "exercises/stdio/dummy.txt";
let file = File::open(path).expect("No file dummy.txt");
let mut s = String::new();
file.read_to_string(&mut s);
println!("{}", s);
}