diff options
Diffstat (limited to 'test.rs')
-rw-r--r-- | test.rs | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -8,13 +8,19 @@ use std::io::{Result, BufRead, BufReader}; fn main() -> Result<()> { let file = File::open("test.rs")?; let mut reader = BufReader::new(file); + let mut lines = vec![]; + loop { let mut line = String::new(); if reader.read_line(&mut line)? == 0 { // reached end of file break; } - print!("{}", line); + line.pop(); + lines.push(line); + } + for line in lines { + println!("{}", line); } print!(" string |