rust-fatfs/examples/mkfatfs.rs
2018-12-29 20:42:49 +01:00

17 lines
415 B
Rust

extern crate fatfs;
extern crate fscommon;
use std::env;
use std::fs;
use std::io;
use fscommon::BufStream;
fn main() -> io::Result<()> {
let filename = env::args().nth(1).expect("image path expected");
let file = fs::OpenOptions::new().read(true).write(true).open(&filename)?;
let buf_file = BufStream::new(file);
fatfs::format_volume(buf_file, fatfs::FormatVolumeOptions::new())?;
Ok(())
}