I think memcpy might do what you want. It is supposed to handle overlapping
memory.
Something like:
int Len = strlen(string);
memcpy(&string[Len],string,Len);
The problem you are coming across is that the strcat function needs to know
where the end of the string you are copying from is. As you are adding to
the end, it won't ever find it, and your memory will consist of one huge
string.
Chris Bruner
Compulife Software Inc.
==============================================
----- Original Message -----
From: "Ignazio Di Napoli" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[email protected]>
Sent: Tuesday, October 25, 2005 12:30 PM
Subject: Bug in StrCat?
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?
Ignazio
--
For information on using the PalmSource Developer Forums, or to
unsubscribe, please see http://www.palmos.com/dev/support/forums/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/