Skip to content

Instantly share code, notes, and snippets.

@dwins
Created August 2, 2015 18:01
Show Gist options
  • Save dwins/04cdeb9d487e9576a47a to your computer and use it in GitHub Desktop.
Save dwins/04cdeb9d487e9576a47a to your computer and use it in GitHub Desktop.
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