diff options
-rw-r--r-- | Cargo.lock | 14 | ||||
-rw-r--r-- | Cargo.toml | 7 | ||||
-rw-r--r-- | src/main.rs | 22 |
3 files changed, 43 insertions, 0 deletions
diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..c832589 --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,14 @@ +[[package]] +name = "khaleesi" +version = "0.1.0" +dependencies = [ + "libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "libc" +version = "0.2.43" +source = "registry+https://github.com/rust-lang/crates.io-index" + +[metadata] +"checksum libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)" = "76e3a3ef172f1a0b9a9ff0dd1491ae5e6c948b94479a3021819ba7d860c8645d" diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..cc78d9f --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "khaleesi" +version = "0.1.0" +authors = ["Nora <nora.widdecke@tu-bs.de>"] + +[dependencies] +libc = "0.2.43" diff --git a/src/main.rs b/src/main.rs new file mode 100644 index 0000000..cc2199e --- /dev/null +++ b/src/main.rs @@ -0,0 +1,22 @@ +use std::env; +use std::fs::File; +use std::io::prelude::*; + +fn main() { + let args: Vec<String> = env::args().collect(); + + //let query = &args[1]; + let filename = &args[1]; + + //println!("Searching for {}", query); + println!("In file {}", filename); + + 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); +} + |