Next: , Previous: Basic File Operations, Up: Top


7 Truncating Files

Force files to a particular length

7.1 Overview

Truncation of files is used to force them to a particular length. If a file longer than specified, the trailing bytes are discarded, if it is shorter than specified it is padded with zeros.

7.2 Usage

— Function: gnome-vfs-truncate (text_uri mchars) (length unsigned-int64) ⇒  (ret <gnome-vfs-result>)

Truncate the file at text-uri to length bytes.

text-uri
string representing the file to be truncated.
length
length of the new file at text-uri.
ret
an integer representing the result of the operation.
— Function: gnome-vfs-truncate-uri (uri <gnome-vfsuri>) (length unsigned-int64) ⇒  (ret <gnome-vfs-result>)

Truncate the file at uri to be only length bytes. Data past length bytes will be discarded.

uri
uri of the file to be truncated.
length
length of the new file at uri.
ret
an integer representing the result of the operation.