Project

General

Profile

Actions

Btrunc » History » Revision 5

« Previous | Revision 5/6 (diff) | Next »
Per Amundsen, 02/16/2014 06:54 AM


Added in 1.9.0

/btrunc <filename> <bytes>

Truncates/extends a file to the specified length.

Parameters

<filename> - The file to truncate.
<bytes> - Number of bytes to truncate/extend to.

Example

alias example {
  ;Create variable %temp and add some data.
  /var %temp = Hello! World

  ;Write to variable %temp's content.
  /bwrite Example 0 $len(%temp) %temp

  ;Truncate the file down to 6 bytes.
  /btrunc Example 6

  ;Read the file into a variable.
  /bread Example 0 $file(Example).size &Example

  ;Print out the variable's content.
  /echo -a $bvar(&Example,1,$bvar(&Example,0)).text

  ;Delete the file.
  /remove Example
}

Updated by Per Amundsen about 10 years ago · 5 revisions

Also available in: PDF HTML TXT