Function setEndPos [src]

Shrinks or expands the file. The file offset after this call is left unchanged.

Prototype

pub fn setEndPos(self: File, length: u64) SetEndPosError!void

Parameters

self: Filelength: u64

Possible Errors

AccessDenied TruncateError
FileBusy TruncateError
FileTooBig TruncateError
InputOutput TruncateError
PermissionDenied TruncateError
Unexpected UnexpectedError

The Operating System returned an undocumented error code.

This error is in theory not possible, but it would be better to handle this error than to invoke undefined behavior.

When this error code is observed, it usually means the Zig Standard Library needs a small patch to add the error code to the error set for the respective function.

Source

pub fn setEndPos(self: File, length: u64) SetEndPosError!void { try posix.ftruncate(self.handle, length); }