At 11:30 AM 10/25/2005, you wrote:
I wanted to duplicate a string. I used:
StrCat(string, string);
this doesn't work. And let my program corrupt even storage heap, forcing a
hard reset. Let's see.
If string is "Andre\0123456789", after the StrCat it becomes
"AndreAndreA789", without the null terminator. This is because StrCat
wanted to copy it from the source string, but when it did there was
already an "A" in its place. This non-terminated string made the program
corrupt the storage.
It's a PalmOS bug?
No, it's not a Palm OS bug. The standard C strcat doesn't allow that usage
either. Basically, copying between strings that overlap is undefined behavior.
-- Ben Combee, Senior Software Engineer, Palm, Inc.
"Combee on Palm OS" weblog: http://palmos.combee.net/
Developer Forum Archives: http://news.palmos.com/read/all_forums/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/