rust-fatfs/examples/mkfatfs.rs

17 lines
415 B
Rust
Raw Permalink Normal View History

2018-12-30 03:42:49 +08:00
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(())
}