On POSIX systems at least, mmap()
cannot be used to increase (or decrease) the size of a file. mmap()
's function is to memory map a portion of a file. It's logical that the thing you request to map should actually exist! Frankly, I'm really surprised that you would actually be able to do this under MS Windows.
If you want to grow a file, just ftruncate()
it before you mmap()
it.