write file add new line

This commit is contained in:
2020-01-30 21:47:11 +08:00
parent a0af96c766
commit 1d24f1d21b

View File

@@ -3,7 +3,7 @@ use std::io::prelude::*;
fn main() -> std::io::Result<()> { fn main() -> std::io::Result<()> {
let mut file = File::create("foo.txt")?; let mut file = File::create("foo.txt")?;
file.write_all(b"Hello, world!")?; file.write_all(b"Hello, world!\n")?;
println!("Hello, world!"); println!("Hello, world!");
Ok(()) Ok(())
} }