Answers for "append to file rust"

1

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");
Posted by: Guest on October-18-2020

Browse Popular Code Answers by Language