Difference between revisions of "$bvar"
From Scriptwiki
m |
m |
||
Line 1: | Line 1: | ||
The $bvar identifier is used to read a [[:Category:Binary Files|binary file]] | The $bvar identifier is used to read a [[:Category:Binary Files|binary file]] | ||
<nowiki>$bvar(&binvar,N,M)</nowiki> | <nowiki>$bvar(&binvar,N,M)</nowiki> | ||
− | This returns ''M'' [[$asc|ascii]] values starting at byte ''N'' from &binvar. If ''N''+''M''-1 is larger then the size of &binvar, it will return ascii values starting at byte ''N'' to the last byte. | + | This returns ''M'' [[$asc|ascii]] values starting at byte ''N'' from &binvar. If ''N''+''M'' -1 is larger then the size of &binvar, it will return ascii values starting at byte ''N'' to the last byte. |
You can use ''N'' = 0 to return the size of &binvar. | You can use ''N'' = 0 to return the size of &binvar. |
Revision as of 11:46, 17 October 2006
The $bvar identifier is used to read a binary file
$bvar(&binvar,N,M)
This returns M ascii values starting at byte N from &binvar. If N+M -1 is larger then the size of &binvar, it will return ascii values starting at byte N to the last byte.
You can use N = 0 to return the size of &binvar.
Properties: text, word, nword, long, nlong
Examples
bset &test 1 65 66 67 68 echo -a $bvar(&test,2,3) returns 66 67 68
This returns 3 ascii values starting at the second byte.
bset &test 1 65 66 67 68 echo -a $bvar(&test,0) returns 4
This returns the size of &test, wich contains four ascii values.
bset &test 1 65 66 67 68 echo -a $bvar(&test,1,$bvar(&test,0)) returns 65 66 67 68
This always returns all values in &test.
bset &test 1 65 66 0 67 68 echo -a $bvar(&test,1,4).text returns AB
This returns the plain text of &test. Notice that it only returns text up to a zero value.