Description: This function reverses the order of groups of bytes in a buffer, and returns a new (rearranged) buffer.
Returns: Buffer
Usage: Script or Steady State
Format: BuffOrder(Buffer, Offset, Size, Increment, N)
Parameters: Buffer { text } { required } { no default: }
Any text or buffer expression to be reordered.
Offset { numeric } { required } { no default: }
Any numeric expression giving the initial buffer position for the ordering, starting at 0. Offset must be greater than or equal to 0.
Size { numeric } { required } { no default: }
Any numeric expression giving the size of each group of bytes.
Increment { numeric } { required } { no default: }
Any numeric expression giving the offset between groups in bytes.
N { numeric } { required } { no default: }
Any numeric expression giving the total number of groups to reverse.
Comments: BuffOrder is part of the driver toolkit. The return value is a buffer containing all bytes specified in the Buffer parameter with groups of bytes reversed. Offset + Size * Increment * N must be no greater than the length of Buffer.
BuffOrder is useful for altering buffers for use with the ParmToBuff or BuffToParm functions.
Example:
buff1 = BuffOrder("0123456789" { Buffer },
0 { Starting offset },
1 { Size of group },
10 { Offset between groups },
1 { Number of groups });
In this example, Buff1 will be equal to "9876543210".
buff2 = BuffOrder("0123456789" { Buffer },
2 { Starting offset },
1 { Size of group },
2 { Offset between groups },
4 { Number of groups });
In this example, Buff2 will be equal to "0132547698".
See Also: