Start code for the I/O project chapter

This commit is contained in:
Carol (Nichols || Goulding) 2016-12-10 14:08:03 -05:00
parent ad2fc2bcf0
commit 4559876018
2 changed files with 36 additions and 1 deletions

View File

@ -55,7 +55,7 @@
- [Running tests](ch11-02-running-tests.md)
- [Test Organization](ch11-03-test-organization.md)
- [I/O]()
- [An I/O Project](ch12-00-an-io-project.md)
- [`Read` & `Write`]()
- [`std::fs`]()
- [`std::path`]()

View File

@ -0,0 +1,35 @@
# An I/O Project
`cargo new --bin greprs`
Project requirements:
- Take a search string and a filename as command line arguments
- Read the file
- Find lines in the file that contain the search string
- Print out those lines
In order to do a good job, we will:
- Organize code (using what we learned in modules, ch 7)
- Use strings (collections, ch 8)
- Handle errors (ch 9)
- Have tests (ch 11)
Generics/traits/lifetimes?
## Command line arguments
* Use `std::env::args()`
Filename: src/main.rs
```rust
use std::env;
fn main() {
let args: Vec<String> = env::args().collect();
println!("{:?}", args);
}
```