mzy1999

导航

 
u_hMapFile = CreateFileMapping(u_file,m_hFile,Null,PAGE_READWRITE,0,0,"FileMapping");
u_lpMapAddress = MapViewOfFile(u_hMapFile,FILE_MAP_ALL_ACCESS,0,0,0)
u_pdata = (unsigned char *)u_lpMapAddress;

  

允许我们再WIN32进程的虚拟地址空间中保留一段内存区域,把目标文件映射到这段虚拟内存之中。

我们可以用存取内存数据的方式直接操作文件中的数据,就好像这些数据放在内存中一样,而实际上,我们并没有也不需要调用API函数来读写文件,更不需要自己提供任何缓冲算法,操作系统将会为我们完成这些工作。

 

CreareFileMapping
//Creates or opens a named or unnamed file mapping object for a specified file
MapViewOfFile
//Maps a view of a file mapping into the address space of a calling process

 

posted on 2020-07-23 18:09  mzy1999  阅读(51)  评论(0编辑  收藏  举报