summaryrefslogtreecommitdiff
path: root/src/binfile.rs
blob: a43f568e77fce982b910729763f321107cb05a06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use std::io::{Error,ErrorKind};

pub fn dump_u32_vec(file_name: &str, data: Vec<u32>) -> Result<(), Error> {
    use std::fs::File;
    use std::io::Write;
    if let Ok(mut file) = File::create(file_name) {
        for value in data {
            file.write_all(&value.to_le_bytes())?;
        }
    } else {
        return Err(Error::new(ErrorKind::Other, "Error creating file"));
    }
    Ok(())
}