list_merge

Merges one list into another at a specified location.

Available in:

Apps (win) Apps (char) Reportwriter RPC Standalone PL
X X X X X

Syntax

list list_merge(list1,list2,loc)
list            list1,list2
int             loc

Description

Returns the resulting (merged) list. Deletes list2.
list1 specifies the list to merge into.

list2 specifies the list to merge and delete.

loc specifies the point of merge relative to the current item:
  • < 0 Before current item in list1.
  • 0 After last item in list1.
  • > 0 After current item in list1.

Example

Prints the first column of the original list, and then prints the first column of the merged list.
{
 int i;
 list xx, zz;
 xx = list_open("20 16 10", 1000, "List6");
 zz = list_open("20 16 10", 1000, "List7");
 list_mod(xx, 1, "1", "2", "3");
 list_mod(xx, 1, "4", "5", "6");
 list_mod(zz, 1, "7", "8", "9");

 list_seek(xx,0);
 for (i=list_rows;i;i--) printf(list_read(xx,0));
 xx = list_merge(xx, zz, 0);
 list_seek(xx,0);
 for (i=list_rows;i;i--) printf(list_read(xx,0));
 list_close(xx);
 list_close(zz);
}