aboutsummaryrefslogtreecommitdiff
path: root/src/helper/init.rs
blob: 084caf54d7db07943d0b54e5c0bf3f12482b6c1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::fs::OpenOptions;
use std::io::{self, Write};

pub fn print_in_file(content: String) -> io::Result<()> {
    // Open the file (create it if it doesn't exist, or truncate it if it does)
    let mut file = OpenOptions::new()
        .write(true)
        .append(true)
        .create(true)
        .open("debug.txt")
        .unwrap();

    if let Err(e) = writeln!(file, "{}", content) {
        eprintln!("Couldn't write to file: {}", e);
    }

    Ok(())
}
ArKa projects. All rights to me, and your next child right arm.