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.
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.
Also, if I get rid of the printf, the error does not occur. This isn't a
solution since using sendStr in some other function will still give me
the bus or program counter error, or a stack overflow. I don't
understand why the stack would overflow since other areas of my program
use way more memory than this part but don't cause any problems.
Any explanations for this?
Stephen Tang
[EMAIL PROTECTED]
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/