Set the size of the file referred to by descriptor to size.

Synopsis

Declared in <bdls_filesystemutil.h>

static
int
truncateFileSize(
    FileDescriptor descriptor,
    Offset size);

Description

Set the size of the file referred to by the specified descriptor to the specified size. descriptor must be open for writing. After the function call, the position is set to the end of the file. Return 0 on success and a non‐zero value otherwise. The behavior is undefined if the file is currently mapped, or if size is greater than the existing size of the file.

Return Value

0 on success, and a non‐zero value otherwise

Parameters

Name

Description

descriptor

file descriptor of the file to resize

size

new size of the file, in bytes

Created with MrDocs