Difference between revisions of "Bread"
(first version, needs better example) |
|||
Line 18: | Line 18: | ||
== Note == | == Note == | ||
− | Note that if you want to read from the start of the file, posistion | + | Note that if you want to read from the start of the file, posistion 0 is the first character in the file. |
[[Category:Binary Files]] | [[Category:Binary Files]] | ||
[[Category:Commands]] | [[Category:Commands]] |
Revision as of 11:45, 13 July 2006
The bread command is used to read content from a file in to a Binary Files
bread [-t] <filename> <S> <N> <&binvar>
This reads N bytes starting at the Sth byte position in the file and stores the result in the binary variable &binvar.
The -t switch reads data up to the next CR/LF.
Examples
bread versions.txt 27 100 &binvar
This will read in to the binary variable &binvar from the 27th position of versions.txt, the follows 100 characters, this will include all $crlf. At the time of writing, the 27th posistion is the start of the 3rd line.
17/02/2006 - mIRC v6.17 Line 1 which is 23 characters followed by two $crlf (which is two characters each)
You can view what is in the varible with the following code:
echo -ag $bvar(&binvar,1,100) or echo -ag $bvar(&binvar,1,100).text
The latter will show you the text output as if you was looking at the information in a text editor. The first would show you the each characters ascii code. Looking at the ascii codes can help you see if the line starts with a space or see where new lines are etc.
Note
Note that if you want to read from the start of the file, posistion 0 is the first character in the file.