You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
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)
The text was updated successfully, but these errors were encountered: