Bread » History » Version 2
Per Amundsen, 02/08/2014 11:31 PM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | */bread -t <filename> <S> <N> <&binvar>* |
||
4 | |||
5 | Reads <N> bytes starting at byte position <S> in the file and stores the result in &binvar. |
||
6 | |||
7 | *Switches* |
||
8 | |||
9 | -t - reads data until the next CR/LF or EOF. |
||
10 | |||
11 | *Parameters* |
||
12 | |||
13 | <filename> - The binary file to read. |
||
14 | <S> - The position in the file to start reading from. |
||
15 | <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> |