Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User windalfred0's Avatar
    Join Date
    Apr 2004
    Posts
    47
    Dear all

    I want to declare an array with 3000 elements, ,and then add data to the array in arbitrary order

    I have tried the following

    CArrayPtrFlat<CResData)* iArray;
    iArray = new (ELeave) CArrayPtrFlat<CResData> (3000);

    then i tried to use a for loop to add data

    *************************************
    for(TInt i=0; i<size; i++) // size is supposed to be smaller than 3K
    {
    id = GetId();
    iArray->InsertL(id, data);
    }
    *************************************

    I know that InsertL cannot perform what i want because i cannot insert to a position GREATER than the number of elements in the array

    So how to achieve the arbbitrary insertion??

    thx a lot

  2. #2
    Super Contributor liuxg's Avatar
    Join Date
    Mar 2003
    Location
    Beijing
    Posts
    3,609
    Please be noted that:

    iArray = new (ELeave) CArrayPtrFlat<CResData> (3000);

    "3000" is the granularity for the array, and it is not the actual size for the array. In fact, you can use it beyond 3000.

    Hope this helps!

    Liuxg
    Forum Nokia
    Last edited by liuxg; 2004-05-13 at 03:43.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Nokia Developer aims to help you create apps and publish them so you can connect with users around the world.

京ICP备05048969号  © Copyright Nokia 2013 All rights reserved