1 use std::{
2     error::Error,
3     fs::OpenOptions,
4     io::{Seek, SeekFrom, Write},
5 };
6 
7 fn main() -> Result<(), Box<dyn Error>> {
8     let mut file = OpenOptions::new().append(true).open("bar.txt")?;
9 
10     file.write_all(b"Did gyre and gimble in the wabe;\n")
11         .unwrap();
12     file.seek(SeekFrom::Start(0)).unwrap();
13     file.write_all(b"All mimsy were the borogoves,\n").unwrap();
14     file.write_all(b"And the mome raths outgrabe.\n").unwrap();
15 
16     Ok(())
17 }
18