TuxSetCArray Function

Action

Sets 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

TuxSetCArray( in hBuffer   : number,
              in nFieldId  : number,
              in sValue    : string,
              in nValueLen : 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.
sValue Binary data to copy to the typed buffer.
nValueLen Size of the binary data copied to the typed buffer (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;