ibec_SetLength

Sets the length of a dynamic-array variable.

Syntax

function ibec_SetLength(AArray : array of variants; NewLength : integer): integer;

Description

AArray is a dynamic-array variable.

ibec_SetLength reallocates the array referenced by AArray to the given length. Existing elements in the array are preserved, the content of newly allocated elements is NULL. ibec_SetLength returns the number of array elements.

Example

execute IBEBlock
returns (iresult integer)
as
begin
  vals = 0;
  iresult = ibec_SetLength(vals, 10);
  suspend; /* iresult = 10 */

  iresult = ibec_SetLength(vals, -1);
  suspend; /* illegal NewLength, iresult = 10 */

  iresult = ibec_SetLength(vals, '25');
  suspend; /* iresult = 25 */

  iresult = ibec_SetLength(vals, NULL);
  suspend; /* illegal NewLength, iresult = 25 */
end