Btrunc » History » Version 1
Per Amundsen, 02/09/2014 12:38 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 | <bytes>* - Number of bytes to truncate/extend to. |
||
| 11 | |||
| 12 | *Example* |
||
| 13 | |||
| 14 | alias example { |
||
| 15 | var %temp = Hello! World |
||
| 16 | ;Write to a variable %temp's content |
||
| 17 | bwrite Example 0 $len(%temp) %temp |
||
| 18 | ;Truncate the file down to 6 bytes |
||
| 19 | btrunc Example 6 |
||
| 20 | ;Read the file into a variable |
||
| 21 | bread Example 0 $file(Example).size &Example |
||
| 22 | ;Print out the variable's content |
||
| 23 | echo -a $bvar(&Example,1,$bvar(&Example,0)).text |
||
| 24 | ;Delete the file |
||
| 25 | remove Example |
||
| 26 | } |