Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

BinaryWriteRecord Function

Overview

The BinaryWriteRecord function directly writes a series of variables to a buffer, Data or File Object.

Syntax/Parameters

Syntax

int = BinaryWriteRecord ( param target, int position, param data, ... );

Parameters

target

A parameter as variable data or as a handle. If target is a variable, the binary content will be altered. If a handle type is supplied, it must be to a Data Object or File Object.

position

An int specifying the zero-based position in bytes to put the new information within data. If set to -1, data is appended to the last position.

data

One or more variables to write to the target. The variables must be of specific types and configuration.

Return Value

Returns an int as the bytes written on success or a formatted error code on failure. Use the GetLastError and GetLastErrorMessage functions to retrieve a formatted error message or detailed error message.

Remarks

BinaryWriteRecord allows binary data to be formatted for later use such as exporting to external systems. Formatting is determined by the size and order of items.

Variables written must be of fixed size and type. Types string, wstring and handle cannot be written. Arrays must be of fixed size. For strings, use the char or wchar type as a fixed array.

Up to 30 variables can be written.

Integer data is written little-endian style (LSB, MSB). To change to big-endian, use swap functions such as Swap32Word.

Literal data cannot be written. To write a literal value, load the data to the desired data by variable and add the variable to the list.

Some systems require byte packing, for example, a char buffer of 30 characters followed by a 32-bit integer. The external system may dword aline such that the integer starts on the 32nd byte, thus extending the last string. to adjust for packing, add byte or char padding variables as required.

The entirety of specified data is placed into the target at the specified position or appended if position is -1. The return value is the size of the record written. The size can also be used to determine if the record matches the required exported size.

Related Functions

Platform Support

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

Legato IDE, Legato Basic