guides:programming:programmers_reference_manual:getbinaryvalue

GetBinaryValue Function

Returns the value of a variable at a given offset.

val = GetBinaryValue( variable, offset, varType [, varSize]

The function has the following parameters:

ParameterDescription
variableA binary structure to return data from.
offsetThe starting offset of the data to be extracted
varTypeThe type of data within the variable, i.e., CHAR, INT, BINARY
varSizeAn optional parameter. This should be set the byte size of the data to be returned. This argument is only required if varType is CHAR or BINARY.

A binary value based on the offset, type and size.

/* This example takes the following steps:

 1. Converts an ANSI string to UNICODE

 2. Determines the length of the string

 3. Extracts the first 10 characters from the string

 4. Converts the UNICODE string to ANSI

*/

 

ansi_string = "Hello World"

* Convert the string to Unicode

unicode_string = ANSI_Unicode( ansi_string : \00\ )

uniLength = GetByteSize( unicode_string )

val = GetBinaryValue( unicode_string, 1, CHAR, 10 )

newString = Unicode_ANSI( val )

 

 
 
  • guides/programming/programmers_reference_manual/getbinaryvalue.txt
  • Last modified: 2024/06/19 20:20
  • by 127.0.0.1