Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter FiveGeneral Functions (continued)

BinaryScan Function

Overview

The BinaryScan function scans a buffer of binary data looking for a pattern match and returns the position of the first match.

Syntax/Parameters

Syntax

int = BinaryScan ( param data, param pattern, [int start], [int end], [int size] );

Parameters

data

A parameter as literal or variable data. The binary content of which will be scanned. If a string type (or literal) is supplied, the zero terminating byte is not included in the size.

pattern

A parameter as literal or variable data. The binary content of which will be use as the pattern. If a string type (or literal) is supplied, the zero terminating byte is not included in the size.

start

An optional int specifying the zero-based starting position for the pattern match within data in bytes. If omitted, the value is zero.

end

An optional int specifying the zero-based ending position for the pattern match within data in bytes. If omitted or zero, the value is the size of data less the size of pattern.

size

An optional int specifying the size pattern in bytes. For string types, the size of the pattern less the zero terminator will be used, for other arrays, the entire allocated array is used.

Return Value

Returns an int as the matching zero-based index position within data or a formatted error code on failure. There are two basic error conditions: the scan failed to match the pattern or the parameters are out of range. The start, end and size parameter must be within the range of the size of data.

Remarks

A buffer can be sequentially scanned by using the returned match position + the start parameter + pattern size as the next index.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic