On Thu, Mar 5, 2009 at 11:14 PM, Michael Comperchio <[email protected]> wrote: > On Mar 5, 2009, at 5:51 PM, John Matthews wrote: >> > On Thu, Mar 5, 2009 at 4:27 PM, Michael Comperchio <mcmp...@...> >> wrote: >> > > memset( buffer, 1000, 0); >> > > strcat(buffer, first_text); >> > > strcat(buffer, second_text); >> >> although >> >> strcpy(buffer, first_text); >> strcat(buffer, second_text); >> >> would be more efficient (no need to clear buffer first). > > True, but that way (memset) I know that the buffer looks like.... it's > been my experience that when working with 'strings' (lpsz_) in C it is > best to be sure of the zero terminator. strcpy simply memov's the > string in and adds a single 0 at the end of the character array, > leaving the rest of the buffer in an unknown state. Me good geek, don't > like unknown state!
If the buffer is being used as a string, then the contents of the rest of the buffer is irrelevant - as long as that string is \0 terminated. -- PJH http://shabbleland.myminicity.com/ind http://www.chavgangs.com/register.php?referer=9375
