Passing RPointerArray as a function argument
| Mon, 2007-10-08 11:47 | |
|
hi i m using RPointerArray I am appending data to the same after allocating memory to Objects. void function(RPointerArray Also once i come back from the function call i m deleting memory of the Objects one after another and then closing using Close() function.. But the program crashes ... Thanks |
|






Forum posts: 68
I think you must pass it as a reference, also RPointerArray is a template class.
void function(RPointerArray<TAny> &pqr)Does it come up with a Panic(error) message?
Forum posts: 71
No actually the application just crashes...
so i tried using a exe this time using a RArray to check what is the exact problem
following is the code snippet....
void call(RArray* abc)
{
TInt i;
for(i=0;abc->Count();i++)
{
console->Printf(_L("%d"),(*abc)[i]);
}
//the application crashes with leave here i cannot get the code as the its a exe...
}
// do the example
a;
LOCAL_C void doExampleL()
{
RArray
a.Append(10);
a.Append(20);
call(&a);
a.Reset();
a.Close();
console->Getch();
}
Is the you cannot pass the address and you have to pass a reference ?
Thanks..
Sohil
Forum posts: 68
No you can definitely pass an address, just in the previous definition you didn't pass a reference or a pointer, so it was copied. That should work as well, but is not a good idea. I think it does Panic, but you don't have the Panic codes enabled. Check http://newlc.com/Display-the-extended-panic-code-in.html and http://www.symbianresources.com/tutorials/general.php#os9 ->"ErrRd Installation Utility".
In any case if your code is exactly as in the post your problem is the for loop.
for(i=0;abc->Count();i++)must be
for(i=0; i < abc->Count(); i++)Forum posts: 71
oh ya..
i m sorry ..
it not the problem with passing the RPointerArray..
itss the problem with the loop...
thanks you very much for the help
Forum posts: 68
No problem sometimes you just can't see what's wrong with your own code.
Forum posts: 71