Hi all,
I may be asking a stupid question here.
I have been having problems modifying strings in other functions
and expecting them to be meaningful after that function returns.
Please consider the following snippit:
<code>
{
...
VoidHand sh;
CharPtr s;
sh = MemHandleNew(SIZE);
fetch(s,sh);
// Now s is garbage and anything that uses it crashes
}
void fetch(CharPtr s, VoidHand sh)
{
s = MemHandleLock(sh);
StrCopy(s,"custard");
MemHandleUnlock(sh);
// s still fine here according to debugger
}
</code>
I would have expected s to be 'custard' after the return from the fetch()
function.
I can retrieve the situation by re-locking the handle sh after fetch()
returns,
which will populate s correctly.
So is it the case that every time I want to read a string I have to lock it?
Thanks
Phil
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/