Q:

append to file rust

// don't forget importing this
use std::io::Write;

let mut file = fs::OpenOptions::new()
      .write(true)
      .append(true)
      .open("file.txt")
      .unwrap();
      
file.write_all(b"to append");
// or
write!(file, "to append");
-1

New to Communities?

Join the community