Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter FiveGeneral Functions (continued)

HexToBuffer Function

Overview

The HexToBuffer function converts a string of hexadecimal characters (two byte representations) into a specified variable. With the exception of strings, the data is read verbatim and treated as binary information.

Syntax/Parameters

Syntax

int = HexToBuffer ( string data, parameter name );

Parameters

data

A source string containing hexadecimal characters in pairs. The string can optionally contain spacing and padding, but the source bytes must not contain spaces. For example, “00 AA 22” is permissible but “0 0 A A 2 2” is not.

name

A variable name. It cannot be a literal or a calculated expression value. It can be of any type except it must be in contiguous storage. See Section 3.7 Contiguous Data for more information. The parameter is treated as a pointer to the area of memory where the variable is held. Strings are an exception in that they must be zero-terminated (see Remarks below).

Return Value

Returns an int containing the number of bytes read or an error code on failure. The data must fit into the target variable or ERROR_OVERFLOW will be returned.

Remarks

The HexToBuffer function can be used to move hexadecimal string data directly into variable or buffers. This function differs from most others in that the provided parameter is always a reference and its content will be altered by the function.

Destination string variables are not really appropriate to use with the HexToBuffer function but are allowed. Strings are processed in such a manner as to always ensure there is a zero-terminating byte. To force a string to be allocated to a specific size, use the PadString function.

Related Functions

Platform Support

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

Legato IDE, Legato Basic