GetArray
Description
Obtains an array that has been created.
Syntax
|
1 |
GetArray() |
Return value
pbarray.
Examples
This example sets up an array, reads in values, and then obtains
the values in the array:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
LPCTSTR *ostr_a; char **sp; int i; pbarray out_array; arrayBounds* bounds; pbuint dim1, dim2, current_dim; pblong itemcount1, itemcount2; PBXRESULT ret; PBArrayInfo* ai; pbstring *iarg, *oarg; typedef PBBoundedArrayCreator<pbvalue_string> BoundedStringArrayCreator; in >> dim1; // allocate memory for pointer bounds bounds = (arrayBounds*)malloc(dim1*sizeof (PBArrayInfo::ArrayBound)); bounds = new arrayBounds[dim1]; // read in lowerbound and upperbound for each dimension // and calculate the array item count itemcount1 = 1; for (i=0;i<dim1;i++) { in >>bounds[i].lowerBound >> bounds[i].upperBound; itemcount1 = itemcount1* (bounds[i].upperBound - bounds[i].lowerBound +1); } sp = new char*[itemcount1]; ostr_a = new LPCTSTR[itemcount1]; iarg = new pbstring[itemcount1]; // Read in array items for (i=0; i<itemcount1; i++) { sp[i] = new char[20]; in >> sp[i]; iarg[i]= session->NewString(sp[i]); } // create bounded simple array and set iarg[i] to it { BoundedStringArrayCreator ac(session, dim1, bounds); current_dim = 1; BoundedArrayItem<pbstring, pbvalue_string, BoundedStringArrayCreator>::f_set_arrayitem (session, ac, dim1, bounds, iarg, current_dim); BoundedArrayItem<pbstring, pbvalue_string, BoundedStringArrayCreator>::array_itemcount = 0; out_array = ac.GetArray(); } |
See also
Document get from Powerbuilder help
Thank you for watching.
Subscribe
Login
0 Comments
Oldest