// Implements http://rosettacode.org/wiki/Read_a_file_line_by_line
use std::io::fs::File;
use std::io::BufferedReader;
use std::os::args;

fn main() {
    let filename = match args().len() {
        1 => fail!("You must enter a filename to read line by line"),
        _ => args()[1]
    };

    let file = File::open(&Path::new(filename));
    let mut reader = BufferedReader::new(file);

    for line in reader.lines() {
        print!("{:s}", line.unwrap());
    }
    
    println!("");
}

// Implements http://rosettacode.org/wiki/Read_a_file_line_by_line
use std::io::fs::File;
use std::io::BufferedReader;
use std::os::args;

fn main() {
    let filename = match args().len() {
        1 => fail!("You must enter a filename to read line by line"),
        _ => args()[1]
    };

    let file = File::open(&Path::new(filename));
    let mut reader = BufferedReader::new(file);

    for line in reader.lines() {
        print!("{:s}", line);
    }
    
    println!("");
}
--- 
+++ 
@@ -13,7 +13,7 @@
     let mut reader = BufferedReader::new(file);
 
     for line in reader.lines() {
-        print!("{:s}", line);
+        print!("{:s}", line.unwrap());
     }
     
     println!("");
Fix read file by line
