fix bug where initial lines were not being written

master
Mike Cugini 3 years ago
parent a70a0828b6
commit 69a5ac4d51
  1. 4
      src/main.rs

@ -94,7 +94,8 @@ fn try_main() -> Result<(), Box<dyn Error>> {
break; break;
} }
let mut out_file = File::create(format!("{}{}", prefix, suffix))?; let mut out_file = File::create(format!("{}{}", prefix, suffix))?;
for _ in 0..opts.lines { out_file.write_all(line.as_bytes())?;
for _ in 1..opts.lines {
line.clear(); line.clear();
match reader.read_line(&mut line)? { match reader.read_line(&mut line)? {
0 => { 0 => {
@ -105,6 +106,7 @@ fn try_main() -> Result<(), Box<dyn Error>> {
} }
}; };
} }
line.clear();
} }
// see if there's anything left for the remainder file // see if there's anything left for the remainder file

Loading…
Cancel
Save