Project

General

Profile

Bread » History » Revision 7

Revision 6 (Per Amundsen, 05/09/2017 09:31 PM) → Revision 7/8 (Per Amundsen, 12/13/2019 06:07 PM)

_Added in 1.9.0_ 

 */bread [-ta] <filename> <S> <N> <&binvar>* 

 Reads <N> bytes starting at byte position <S> in the file and stores the result in &binvar. 

 *Switches* 

 -t - reads data until the next [[$crlf]] or [[$feof]]. EOF. 
 -a - Disables UTF-8 encoding of characters in the range 0-255, as long as the line contains no characters > 255. 

 *Parameters* 

 <filename> - The binary file to read. 
 <S> - The byte position in the file to start reading from. 
 <N> - Number of bytes to read. 
 <&binvar> - The &binvar to read the data into. 

 *Example* 

 <pre> 
 ;noop $example(FileA, FileB) 
 alias example { 
    ;Read the whole file into a binary variable 
    bread $qt($1) 0 $file($1).size &tempFile 
 
    ;Write the bytes form the binary variable to a file 
    bwrite $qt($2) 0 -1 &tempFile 
 } 
 </pre>