$bvar » History » Version 7
Per Amundsen, 01/02/2019 03:34 AM
1 | 1 | Per Amundsen | _Added in 1.9.0_ |
---|---|---|---|
2 | |||
3 | *$bvar(&binvar,N,M)* |
||
4 | |||
5 | 2 | Per Amundsen | Returns M "ASCII":http://www.asciitable.com/ values from a &binvar starting from the Nth byte. |
6 | 1 | Per Amundsen | |
7 | 6 | Per Amundsen | _N-N2 can be used to get a range of ASCII values._ |
8 | _N- can be used to get all ASCII values from position N._ |
||
9 | |||
10 | 1 | Per Amundsen | *Parameters* |
11 | |||
12 | &binvar - The &binvar to use. |
||
13 | N - Position to start retrieving bytes. |
||
14 | M - Numbers of bytes to get. |
||
15 | |||
16 | *Properties* |
||
17 | |||
18 | 2 | Per Amundsen | .text - Returns plain text instead of "ASCII":http://www.asciitable.com/ values. |
19 | 7 | Per Amundsen | word - Outputs decimal value of a 2-byte word, seeing bytes in little-endian byte order (low value first) |
20 | .nword - Outputs decimal value of a 2-byte word, seeing bytes in big-endian byte order (high value first) |
||
21 | .long - Outputs decimal value of a 4-byte dword (unsigned long), seeing bytes in little-endian byte order (low value first) |
||
22 | .nlong - Outputs decimal value of a 4-byte dword (unsigned long), seeing bytes in big-endian byte order (high value first) |
||
23 | 1 | Per Amundsen | |
24 | *Example* |
||
25 | |||
26 | <pre> |
||
27 | 3 | Per Amundsen | ; Returns the length of the binary variable. |
28 | 1 | Per Amundsen | //echo -ag $bvar(&binvar,0) |
29 | |||
30 | 4 | Per Amundsen | ; Returns ASCII value at position N. |
31 | 1 | Per Amundsen | //echo -ag $bvar(&binvar,1) |
32 | 4 | Per Amundsen | |
33 | 1 | Per Amundsen | ; Returns ASCII values from 5 to 8. |
34 | 6 | Per Amundsen | //echo -ag $bvar(&binvar,5,3) |
35 | |||
36 | ; Returns ASCII values from 5 to end. |
||
37 | //echo -ag $bvar(&binvar,5-) |
||
38 | 1 | Per Amundsen | |
39 | 3 | Per Amundsen | ; Returns plain text from 5 to 8 up to the first zero character. |
40 | 1 | Per Amundsen | //echo -ag $bvar(&binvar,5,3).text |
41 | 5 | Per Amundsen | |
42 | ; Returns &binvar if the binvar exists. |
||
43 | //echo -ag $bvar(&binvar) |
||
44 | 1 | Per Amundsen | </pre> |