Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SetEndOfFile missing #8

Open
tlhackque opened this issue Mar 5, 2018 · 0 comments
Open

SetEndOfFile missing #8

tlhackque opened this issue Mar 5, 2018 · 0 comments

Comments

@tlhackque
Copy link

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant