TuxGetString Function

Action

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

FML, FML32, STRING

Include file

TUXEDO.bdh

Syntax

TuxGetString( in  hBuffer     : number,
              in  nFieldId    : number,
              out sString     : string,
              in  nStringSize : 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.
sString Variable receiving the string retrieved from the typed buffer.
nStringSize Length of the variable receiving the string (optional).
nIndex Array index (optional). This parameter has to be passed to the function if the field identifier specifies a string array.

Example

const
  ID_STRINGS      :=  8;
  ID_CONCATENATED := 16;

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

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

    // store two strings in buffer
    TuxSetString(hBuffer, ID_STRINGS, "Hello", 1);
    TuxSetString(hBuffer, ID_STRINGS, " world!", 2);

    // concatenate string
    Tux_tpcall("CONCAT", hBuffer, 0, hBuffer, olen, TPNOFLAGS); 

    // retrieve concatenated string
    TuxGetString(hBuffer, ID_CONCATENATED, sString);
    Tux_tpcommit(0);
  end TMain;

Sample scripts

bankappn.bdf