C programming iSeries / AS400 <c400-l@xxxxxxxxxxxx> on Tuesday, September
20, 2005 at 3:02 PM -0500 wrote:
>memcpy(wrkFld2, testStr, len > sizeof(wrkFld2) ? sizeof(wrkFld2) : len);

Maybe a minor detail, but wouldn't this be better as:

memcpy(wrkFld2, testStr, len > sizeof(wrkFld2) ? sizeof(wrkFld2) -1 : len);

That way you wouldn't lose that final null terminator if testStr happens
to be bigger than wrkFld2.

Robert Martin
Network Engineer
Judd Wire Inc.
124 Turnpike Road
Turners Falls, MA 01376-2699
Voice - (413) 863-4357 ext 230
Fax - (413) 863-2305 
All of us get lost in the darkness,
Dreamers learn to steer by the stars -- Neil Peart

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].