Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

Get16String Function

Overview

The Get16String function retrieves a 16-bit wstring from a buffer at a specified byte position for a specified length.

Syntax/Parameters

Syntax

wstring = Get16String ( buffer data, int position, [int characters] );

Parameters

data

A buffer as bytes, chars, string, any variable type or to a Data Object. This is referenced on a byte by byte position to read all bytes.

position

An int specifying a zero-based position in bytes. This should point to the start of the data for the wstring. If the position plus the size of the data element is outside of the scope of the buffer, a range error will be returned.

characters 

An optional int specifying the number of characters to retrieve. If omitted, the value defaults to the total buffer size less the specified position.

Return Value

Returns a wstring comprised of the data read or empty on failure. Use the GetLastError function to retrieve error information.

Remarks

The Get16String function allows a script to reach into a buffer, access a specific set of characters that presumably make up a string.

If the source information contains a zero word, it will terminate the returned string at that position. Should the specified area not contain an ending zero word, one will automatically be added.

When the source data is a string or wstring type, the allowed data range is the allocated string size, not the string length (the character count to the terminating zero).

Use the GetLastError, IsError or IsNotError functions to differentiate between a return value of an empty string and an error.

Related Functions

Platform Support

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

Legato IDE, Legato Basic