-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
It would be handy to have SetEndOfFile() available in the API.
In particular, when creating a large file of known size, this would allow preallocating the disk blocks without initializing them. (e.g. SetFilePointer( size), SetEndOfFile, SetFilePointer(0), WriteFile()* - this results in a best-effort contiguous file, and requires no unnecessary writes of data.) It also would permit estimating an output file size + truncating, and best-effort contiguous extends.
Currently, the best one can do is SetFilePointer(size-1); WriteFile(1 byte); SetFilePointer(0). This at least requires that the last byte is written - and may result in a sparse file rather than allocating the blocks between 0 and EOF. (or previous EOF and new EOF)
Metadata
Metadata
Assignees
Labels
No labels