Hi,
You are trying to write into an unallocated Memory. Each memory pointer
is of 4 bytes long and in your code you have allocated just 4 bytes and
trying to write more than one address. By allocating 4 bytes -
list = MemPtrNew(RETURN_WORDS); --- this just allocates memory to store
1 address(4 bytes)
you can store only one address but you are trying to store more than 1
address( 4 ) -
for (i=0;i<RETURN_WORDS;i++)
list[i]=listRow + ((StrLen(info) +1)*i);
solution:
You have to allocate memory for list = 4 * (Number of address you are
going to store) i.e 4 * 4
list = MemPtrNew(RETURN_WORDS * 4);
for (i=0;i<RETURN_WORDS;i++)
list[i]=listRow + ((StrLen(info) +1)*i);
This will work fine without any problem.
Thanks
Manikumar K
--------------------------------------------------------------------
Developers' Nation
You've got the questions; we've got the answers.
Visit Us At :http://www.devnation.net for Palm Developer Support
--------------------------------------------------------------------
"Jaydee" <[EMAIL PROTECTED]> wrote in message news:49912@palm-dev-forum...
>
> I've been having major problems getting a Char** variable to work
correctly.
> I've tried allocating memory in a number of different way, and had no
luck.
> This
> is the code I am currently trying. During the loop the Emulator throws up
> memory
> access non-fatal errors, but depending on how many values I put in I get
> fatal errors
> later on. When I exit the program a bus error (accessing non-even
location)
> is thrown
> up. I am pretty sure the code I use later is correct, as with other
> definitions the place
> the error is thrown changes.
> Any help would be much appreciated.
> JD
>
>
>
> #define RETURN_WORDS 4
> ...
> Char **list;
> Char *listRow;
> ...
> listRow = MemPtrNew((StrLen(info)+1) * RETURN_WORDS);
> list = MemPtrNew(RETURN_WORDS);
> for (i=0;i<RETURN_WORDS;i++)
> list[i]=listRow + ((StrLen(info) +1)*i); file://line that
causes
> errors.
>
>
>
>
>
>
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/