Project

General

Profile

Bread » History » Version 5

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

1 1 Per Amundsen
_Added in 1.9.0_
2
3 4 Per Amundsen
*/bread [-t] <filename> <S> <N> <&binvar>*
4 1 Per Amundsen
5
Reads <N> bytes starting at byte position <S> in the file and stores the result in &binvar.
6
7
*Switches*
8
9 5 Per Amundsen
-t - reads data until the next [[$crlf]] or EOF.
10 1 Per Amundsen
11
*Parameters*
12
13
<filename> - The binary file to read.
14 3 Per Amundsen
<S> - The byte position in the file to start reading from.
15 1 Per Amundsen
<N> - Number of bytes to read.
16
<&binvar> - The &binvar to read the data into.
17
18
*Example*
19
20 2 Per Amundsen
<pre>
21 1 Per Amundsen
;noop $example(FileA, FileB)
22
alias example {
23
   ;Read the whole file into a binary variable
24
   bread $qt($1) 0 $file($1).size &tempFile
25
 
26
   ;Write the bytes form the binary variable to a file
27
   bwrite $qt($2) 0 -1 &tempFile
28
}
29 2 Per Amundsen
</pre>