> It seems that when I create a large string with StrCopy and StrCat, I
> cannot print that string without causing a bus error or a program
> counter error. The program counter error looks like:
>
> "QTest" (unknown version) is attempting to change the emulated
> program counter to 0x69696969. This address is invalid because
> it's not even.
0x69696969? i dont want to know where that number came from :)
> Here's the relevant fragment of my code:
*
> char *sendStr;
> Handle H;
> H = (Handle)MemHandleNew(2000);
> sendStr = (char *)MemHandleLock((VoidHand)H);
>
> StrCopy(sendStr,
>
>"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
>
> printf("sendstr = \n%s",sendStr);
>
>
> If I use
>
> StrCopy(sendStr, "iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
> StrCat(sendStr,
>
>"iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii");
>
> or some other variation involving multiple StrCats, I still get the
> error. However, this only seems to happen if the final length of sendStr
> exceeds a certain value (around 115 characters). If sendStr is small
> enough, there's no problem. I don't understand this since I'm allocating
> far more memory than is required.
maybe the "string" you are copying is barfing the stack somewhere?
'i' = 105 = 0x69
you maybe corrupting the stack somewhere, and, as a result.. corrupting
the "program counter".. and wola.. try storing your string in a resource
instead of as a "local" object in the application..
you are messing with too much memory, and it just cannot handle it.
if you changed yout string to "jjjjjjjjjjjjjjjjjjjjj", then i bet your
error would be "0x70707070" :P - just a small hunch i have :)) try it.
PilRC allows you to create a string resource, and you should be able to
do the same in the Code Warrior environment.
hope this helps.
// az
[EMAIL PROTECTED]
http://www.ardiri.com/ <--- free games!
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/