TuxGetCArray Function

Action

Retrieves the content of a specified binary data field within a typed buffer. This function can be used to manipulate any of the following predefined buffer types:

FML, FML32, CARRAY

Include file

TUXEDO.bdh

Syntax

TuxGetCArray( in  hBuffer     : number,
              in  nFieldId    : number,
              out sBinary     : string,
              in  nBinarySize : number optional,
              in  nIndex      : number optional ): boolean;

Return value

  • true if successful.

  • false otherwise.

Parameter Description
hBuffer Typed buffer allocated with TuxGetBuffer or Tux_tpalloc.
nFieldId Identifier specifying a field of the typed buffer.
sBinary Buffer receiving the binary data retrieved from the typed buffer.
nBinarySize Size of the buffer receiving the binary data (optional).
nIndex Array index (optional). This parameter has to be passed to the function if the field identifier specifies an array.

Example

const
  ID_DATA   :=  8;
  ID_RESULT := 16; 

dcltrans
  transaction TMain
  var
    hBuffer, olen : number;
    sResult       : string;
    sString       : string;
  begin
    Tux_tpbegin(30, 0); 

    // allocate buffer
    TuxGetBuffer(hBuffer, "FML", NULL, 1024); 

    // store data and password in buffer
    TuxSetCArray(hBuffer, ID_DATA, "\h54396e31009f", 6, 1);
    TuxSetCArray(hBuffer, ID_DATA, "\h4034f83ad930", 6, 2);

    // encrypt data 
    Tux_tpcall("XOR", hBuffer, 0, hBuffer, olen, TPNOFLAGS);
 
    // retrieve encrypted data
    TuxGetCArray(hBuffer, ID_RESULT, sString);
    Tux_tpcommit(0);
  end TMain;