Project

General

Profile

Btrunc » History » Revision 4

Revision 3 (Per Amundsen, 02/09/2014 12:39 AM) → Revision 4/6 (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* 

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

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

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

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

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

   
   ;Delete the file. file 
   remove Example 
 } 
 </pre>