Skip to content

SetEndOfFile missing #8

Description

@tlhackque

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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions