
"Jonathan Graehl" <jonathan@graehl.org> wrote in message news:413795B2.4080301@graehl.org...
In any case it looks like this SetFileValidData for win32,
The docs say this works only for NTFS volumes. The description of the parameter ValidDataLength says: "This parameter must be a positive value that is greater than the current valid data length, but less than the current file size." It looks like SetEndOffFile is the correct function. The remarks say: "This function can be used to truncate or extend a file. If the file is extended, the contents of the file between the old EOF position and the new position are not defined."
and ftruncate for POSIX, could be used by memmap.c to support automatic creation of an appropriately sized backing file in the constructor for mapped_file (and the constructor for mapped output files in the IO lib could expose this).
This could be useful.
I still think a truncate/SetFileValidData wrapper would be nice for the filesystem lib.
I'm willing to code this if people think it's a good idea. It frees users from having to first create an empty file of the right length first.
I'm interested. It sounds like something people want for memory-mapped files. But be careful reading those windows docs! ;-) Jonathan