At 12:38 PM 9/7/2003, Hal Mueller wrote:
I ran into a situation where StrNCat was refusing to add anything to a destination string if the destination length exceeded 2048 characters. The destination buffer has plenty of space.

After looking at the 3.5 source for StrNCat, I believed at first it was because of the use of type Char in the first line to track the size. (After looking at it again, I'm not so sure that's really the cause, but as it's only an academic question for me now I'll leave it). Sending this to dev-forum in case anyone else runs into the same problem. It's pretty easy to work around once you notice the problem.

This posting prompted me to revisit the Palm OS documentation for StrNCat, and I was surprised to find the following:


Comment This function differs from the standard C strncat function in these ways:
• StrNCat treats the parameter n as the maximum length in
bytes for dst. That means it will copy at most n -
StrLen(dst) - 1 bytes from src. The standard C function
always copies n bytes from src into dst. (It copies the entire
src into dst if the length of src is less than n).



I had always thought StrNCat emulated strncat.





-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to