Hi all,

I was coding up a simple routine to attach an elipsis to the end of strings
which are too long for a table cell and StrCat() seemed to work only once in
a while.  Sometimes it would copy the '...' properly and other times it
would copy in junk (right now I see a pound sign and a colon, for example).

I threw in my own cheesy code:

(note:  textLen is the number of bytes that will fit within the table cell
as returned by FntCharInWidth() minus the width of an elipsis - '...')

CharPtr pChar = str+textLen;
for (int loop = 0; loop < 3; loop++)
        *(pChar++) = '.';
*pChar = '\0';

And suddenly it works.  I've verified that my copy-to string (a simple char
array) is plenty large enough.  I've loaded values into my database for
display, compiled with my version vs. StrCat() several times and the results
seem consistent.

Anyone else see behavior like this, or am I just committing one of those
unbelievably simple beginner programmer mistakes that we all do from time to
time?  :)

Jeff


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

Reply via email to