SetAt

PowerBuilder Native Interface

PBArrayAccessor template class:

SetAt method

Description

Syntax

SetAt(pblong dim[ ], ValueType v)
SetAt(pblong dim[ ], LPCTSTR string)
SetAt(pblong dim[ ], pbstring string)

Return Values

Examples

template < typename T, pbvalue_type I>
void ArrayCreator<T, I>::f_unbounded_simple_array(
   IPB_Session* session,
   ifstream in,
   fstream out,
   LPCSTR data_type)
{
  pbarray out_array;
  int i;
  pblong dim[4], itemcount1, itemcount2;

  T *iarg, oarg;

  in >> itemcount1;
  iarg = new T[itemcount1];
// Create unbounded integer array
  {
   PBUnboundedArrayCreator<I> ac(session); 
   out_array = ac.GetArray();
   PBArrayAccessor<I> aa(session, out_array);
   for(i=0; i<itemcount1; i++)
      in >> iarg[i];
   for (i=0; i<itemcount1; i++)
   {
     dim[0]=i+1;
     aa.SetAt(dim, iarg[i]);
   }
   itemcount2 = session->GetArrayItemCount(out_array);
   out <<"The array item count is "<< itemcount2 <<
      endl;
   for (i=0; i<itemcount2; i++)
   {
    dim[0]=i+1;
    oarg=aa.GetAt(dim);
    if (oarg != iarg[i])
     out << "*** ERROR"<< endl;
    else
     out << oarg << " ";
   }
  }
  delete []iarg;
  out << endl;
  return;
}

See Also