Last active
December 20, 2015 05:09
-
-
Save AleksLitynski/6076352 to your computer and use it in GitHub Desktop.
file IO error
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
let file_read: Result<@Reader, ~str> = std::io::file_reader(~std::path::Path("handw.rc")); | |
let file_text:~[~str] = match file_read { | |
Ok(file) => return file.read_lines(), | |
Err(e) => { | |
println(fmt!("Error reading file: %?", e)); | |
return ~[]; | |
} | |
}; |
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
extern mod std; | |
use std::io::*; | |
use std::path::*; | |
fn main(){ | |
let rdr = file_reader(~PosixPath("testing.rs")); | |
let r = rdr; | |
let readText = match r { | |
Ok(file) => {file.read_lines()} | |
Err(e) => {~[]} | |
}; | |
println( fmt!("%?", readText) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment