当前位置: 首页 > 文档资料 > Perl 入门教程 >

truncate

优质
小牛编辑
122浏览
2023-12-01

描述 (Description)

此函数将FILEHANDLE指定的文件大小截断(缩小)到指定的LENGTH(以字节为单位)。 如果系统上未实现该功能,则会产生致命错误。

语法 (Syntax)

以下是此函数的简单语法 -

truncate FILEHANDLE, LENGTH

返回值 (Return Value)

如果操作失败,则此函数返回undef,成功时返回1。

<!--

例子 (Example)

Following is the example code showing its basic usage, it will truncate file "test.txt" to zero length −

When above code is executed, it produces the following result −

-->