Guest User

Untitled

a guest
May 22nd, 2018
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. use std::fs::File;
  2. use std::io::prelude::*;
  3.  
  4.  
  5. fn main() {
  6. let filename = "/home/silver/projects/rust/fr/sample.file";
  7.  
  8. let mut f = File::open(filename).expect("file not found");
  9.  
  10. let mut contents = String::new();
  11. f.read_to_string(&mut contents)
  12. .expect("something went wrong reading the file");
  13.  
  14. println!("With text:\n{}", contents);
  15. }
Add Comment
Please, Sign In to add comment