feat: dos header的读取写完了。

This commit is contained in:
2024-12-08 21:28:50 +08:00
parent f8ec30acfc
commit f837e7cdaf
19 changed files with 1065 additions and 185 deletions

View File

@@ -1,15 +1,12 @@
use memmap::*;
// TODO: 打开文件,并将文件映射到内存
pub fn mmap_mut_file(file_path: &str) -> Result<MmapMut, std::io::Error> {
let file = std::fs::OpenOptions::new()
.read(true)
.write(true)
.open(file_path)?;
pub fn mmap_mut_file(file_path: &str) -> Result<Mmap, std::io::Error> {
let file = std::fs::OpenOptions::new().read(true).open(file_path)?;
unsafe {
MmapOptions::new()
.map_mut(&file)
.map(&file)
.map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e.to_string()))
}
}