Rollup merge of #36374 - dangcheng:patch-1, r=steveklabnik

book: fix mistake (File::open -> File::create)
This commit is contained in:
Guillaume Gomez 2016-09-14 17:15:37 +02:00 committed by GitHub
commit 4476b7b43b

View file

@ -275,7 +275,7 @@ wont have its methods:
[write]: ../std/io/trait.Write.html
```rust,ignore
let mut f = std::fs::File::open("foo.txt").expect("Couldnt open foo.txt");
let mut f = std::fs::File::create("foo.txt").expect("Couldnt create foo.txt");
let buf = b"whatever"; // byte string literal. buf: &[u8; 8]
let result = f.write(buf);
# result.unwrap(); // ignore the error
@ -294,7 +294,7 @@ We need to `use` the `Write` trait first:
```rust,ignore
use std::io::Write;
let mut f = std::fs::File::open("foo.txt").expect("Couldnt open foo.txt");
let mut f = std::fs::File::create("foo.txt").expect("Couldnt create foo.txt");
let buf = b"whatever";
let result = f.write(buf);
# result.unwrap(); // ignore the error