~irimi1/learning-rust

5f333e2ae9b3d7dec1c9f41be602e45a1d13c1e3 — Manuel Groß 2 years ago 62faacb
minigrep: Read and print file contents
1 files changed, 6 insertions(+), 0 deletions(-)

M projects/minigrep/src/main.rs
M projects/minigrep/src/main.rs => projects/minigrep/src/main.rs +6 -0
@@ 1,4 1,5 @@
use std::env;
use std::fs;

fn main() {
    let args: Vec<String> = env::args().collect();


@@ 8,4 9,9 @@ fn main() {

    println!("Searching for {}", query);
    println!("In file {}", filename);

    let contents = fs::read_to_string(filename)
        .expect("Something went wrong reading the file");

    println!("With text:\n{}", contents);
}