Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::fs::File;
- use std::io::prelude::*;
- fn main() {
- let filename = "/home/silver/projects/rust/fr/sample.file";
- let mut f = File::open(filename).expect("file not found");
- let mut contents = String::new();
- f.read_to_string(&mut contents)
- .expect("something went wrong reading the file");
- println!("With text:\n{}", contents);
- }
Add Comment
Please, Sign In to add comment