> I'm getting a problem when using StrNCopy to copy a defined lenght of a
> string into another. Sometimes, when a copy a odd lenght from a string to
> another, the destination string is not terminated correcty. See the
example
> below:
>
> Char Variable1[11];
> Char Variable2[7];
>
> StrCopy(Variable1, "1234567890");
> StrNCopy(Variable2, Variable1, 4);
> StrNCopy(Variable2, Variable1, 5);
>
> Does anybody know why? Thanks!
yes. StrNCopy() will copy n chars, and, it doesn't always have to
put a null terminator on it - what you should do is set the contents
of your buffer to 0 manually.
> Char Variable1[11] = {};
> Char Variable2[7] = {};
will do it, but, if your going to be using Variable2 more than once:
> MemSet(Variable2, 7, 0);
before you do any string operations.
---
Aaron Ardiri [EMAIL PROTECTED]
CEO - CTO +46 70 656 1143
Mobile Wizardry http://www.mobilewizardry.com/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/support/forums/