Created
August 2, 2015 18:01
-
-
Save dwins/04cdeb9d487e9576a47a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::prelude::*; | |
use std::fs::File; | |
fn main() { | |
let mut f = File::create("hello_world.txt").unwrap(); | |
f.write_all(b"Hello world!"); | |
let mut f = File::open("hello_world.txt").unwrap(); | |
let mut s = String::new(); | |
f.read_to_string(&mut s); | |
assert_eq!(s, "Hello world!"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment