C++ Memory Mapped File Implementation

前端 未结 2 699
面向向阳花
面向向阳花 2021-01-21 11:52

I have no problems implementing the memory mapped file. The question is. Assuming this returns a valid memory view.

void* pBuf = MapViewOfFile(hMapFile,  
               


        
相关标签:
2条回答
  • 2021-01-21 12:08

    Probably the easiest approach is to use the boost memory mapped file classes which give the additional benefit of being portable.

    0 讨论(0)
  • You can use the placement new operator or you can cast the address to a structure or class you want to use. The advantage of placement new is that the constructor of the class will be called. If you use from then on that pointer you don't need to copy the data but read and write directly to it.

    0 讨论(0)
提交回复
热议问题