vimpunk / mio

Cross-platform C++11 header-only library for memory mapped file IO
MIT License
1.71k stars 157 forks source link

Unable to write data to empty file #77

Closed LeoYang06 closed 2 years ago

LeoYang06 commented 3 years ago

Creating a memory mapped file with the specified capacity in system memory is not supported, that means it is not possible to perform a write operation on an empty file.

LoveChina-3000 commented 2 years ago

我也遇到这个问题

LeoYang06 commented 2 years ago

我也遇到了这个问题

You can refer to FileHelpersCpp implementation,you need to accurately calculate the size of the data to be written before writing,then pre-allocate space,and then use a memory-mapped file to write data quickly.