Project

General

Profile

Btrunc » History » Version 4

Per Amundsen, 02/16/2014 06:54 AM

1 1 Per Amundsen
_Added in 1.9.0_
2
3
*/btrunc <filename> <bytes>*
4
5
Truncates/extends a file to the specified length.
6
7
*Parameters*
8
9
<filename> - The file to truncate.
10 3 Per Amundsen
<bytes> - Number of bytes to truncate/extend to.
11 1 Per Amundsen
12
*Example*
13
14 2 Per Amundsen
<pre>
15 1 Per Amundsen
alias example {
16 4 Per Amundsen
  ;Create variable %temp and add some data.
17
  /var %temp = Hello! World
18
19
  ;Write to variable %temp's content.
20
  /bwrite Example 0 $len(%temp) %temp
21
22
  ;Truncate the file down to 6 bytes.
23
  /btrunc Example 6
24
25
  ;Read the file into a variable.
26
  /bread Example 0 $file(Example).size &Example
27
28
  ;Print out the variable's content.
29
  /echo -a $bvar(&Example,1,$bvar(&Example,0)).text
30
31
  ;Delete the file.
32 1 Per Amundsen
  remove Example
33
}
34 2 Per Amundsen
</pre>